remove nans from list code example
Example 1: remove nan from list python
cleanedList = [x for x in countries if str(x) != 'nan']
Example 2: delete nans in df python
df[~np.isnan(df)]
cleanedList = [x for x in countries if str(x) != 'nan']
df[~np.isnan(df)]