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,
use numpy fancy indexing:
In [29]: countries=np.asarray(countries) In [30]: countries[countries!='nan'] Out[30]: array(['USA', 'UK', 'France'], dtype='|S6')