>>> df.count(axis='columns') 0 3 1 2 2 3 3 3 4 3 dtype: int64
Here is what the above code is Doing:
1. We’re using the .count() method on the df DataFrame.
2. We’re specifying the axis argument as ‘columns’.
3. The result is a Series with the number of non-NaN values in each column.