Saya memiliki daftar yang menghitung nilai, salah satu nilai yang saya dapatkan adalah 'nan'
countries= [nan, 'USA', 'UK', 'France']
Saya mencoba untuk menghapusnya, tetapi saya selalu mendapatkan kesalahan
cleanedList = [x for x in countries if (math.isnan(x) == True)]
TypeError: a float is required
Ketika saya mencoba yang ini:
cleanedList = cities[np.logical_not(np.isnan(countries))]
cleanedList = cities[~np.isnan(countries)]
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
"nan", bukan nilai NaN yang sebenarnya.