remove nan df python code example
Example 1: remove nan from list python
cleanedList = [x for x in countries if str(x) != 'nan']
Example 2: dropping nan in pandas dataframe
df.dropna(subset=['name', 'born'])
cleanedList = [x for x in countries if str(x) != 'nan']
df.dropna(subset=['name', 'born'])