9951 explained code solutions for 126 technologies


python-pandasHow to execute not equal query on dataframe


import pandas as pd

df = pd.DataFrame({
  'phone': ['ip5', 'ip6', 'ip8', 'sms', 'xi'],
  'price': [204, 304, 404, 405, 305]
})

found = df[df['price'] != 304]ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

!=

not equal expressions (price is not equal to 304 in our case)

df[

filter dataframe based on given expression

found

will contain filtered dataframe