The count() method returns the number of non-NaN values in each column:
>>> df1.count()
a 3
b 2
d 1
dtype: int64
Similarly, count(axis=1) returns the number of non-NaN values in each row.
The count() method returns the number of non-NaN values in each column:
>>> df1.count()
a 3
b 2
d 1
dtype: int64
Similarly, count(axis=1) returns the number of non-NaN values in each row.