I have a really big DataFrame and I was wondering if there was short (one or two liner) way to get the a count of non-NaN entries in a DataFrame. I don\'t want to do this on
If you want to sum the total count values which are not NAN, one can do;
np.sum(df.count())
The count() method returns the number of non-NaN values in each column:
NaN
>>> df1.count() a 3 b 2 d 1 dtype: int64
Similarly, count(axis=1) returns the number of non-NaN values in each row.
count(axis=1)