I have a list that countain values, one of the values I got is \'nan\'
countries= [nan, \'USA\', \'UK\', \'France\']
I tried to remove it,
In your example 'nan' is a string so instead of using isnan() just check for the string
'nan'
isnan()
like this:
cleanedList = [x for x in countries if x != 'nan']