python - Removing a nan from a list -
while trying work on project pandas have run problem. had list nan value in , couldn’t remove it.
i have tried:
incoms=data['int_income'].unique().tolist() incoms.remove('nan') but didn’t work:
list.remove(x): x not in list"
the list incoms follows:
[75000.0, 50000.0, 0.0, 200000.0, 100000.0, 25000.0, nan, 10000.0, 175000.0, 150000.0, 125000.0]
what can cleaned list don't put values that, once converted strings, 'nan'.
the code :
incoms = [incom incom in incoms if str(incom) != 'nan']
Comments
Post a Comment