SyntaxFix
Write A Post
Hire A Developer
Questions
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']