remove nan's in a list code example
Example 1: remove nan from list python
cleanedList = [x for x in countries if str(x) != 'nan']
Example 2: python remove nan rows
df = df[df['my_var'].notna()]
cleanedList = [x for x in countries if str(x) != 'nan']
df = df[df['my_var'].notna()]