filter NaN list python code example
Example 1: remove nan from list python
cleanedList = [x for x in countries if str(x) != 'nan']
Example 2: pandas filter non nan
filtered_df = df[df['name'].notnull()]
cleanedList = [x for x in countries if str(x) != 'nan']
filtered_df = df[df['name'].notnull()]