Usuń nan z listy Python
cleanedList = [x for x in countries if str(x) != 'nan']
Worried Walrus
cleanedList = [x for x in countries if str(x) != 'nan']
import math
x = float('nan')
math.isnan(x)
True
math.isnan(n)
# Test to see if it is equal to itself
def isNaN(num):
return num != num
import math
print math.isnan(float('NaN'))OutputTrue
print math.isnan(1.0)OutputFalse
>>> pd.isnull(None)
True