counting the number of non-zero numbers in a column of a df in pandas/python
Numpy's count_nonzero function is efficient for this.
np.count_nonzero(df["c"])
I have a df that looks something like:
a b c d e  0 1 2 3 5 1 4 0 5 2 5 8 9 6 0  4 5 0 0 0
I would like to output the number of numbers in column c that are not zero.