How to I count the occurrences of NaN
in my list? My data looks like this:
[365788, 267102, 170941, 'NaN', 243293, 267093, 'NaN', 370448, 'NaN', 197091]
How to I count the occurrences of NaN
in my list? My data looks like this:
[365788, 267102, 170941, 'NaN', 243293, 267093, 'NaN', 370448, 'NaN', 197091]
You can use collections.Counter
:
from collections import Counter
Counter(yourlist)
You will have the number of occurences for every unique value of your list
Another option is:
Use the count
method of a list:
yourlist.count('Nan')