9951 explained code solutions for 126 technologies


python-pandasHow to select not null values from dataframe


import pandas as pd

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

found = df[df['phone'].notna()]ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

.notna()

finds all values that are not NaN

found

will contain filtered dataframe