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