human
Counting non zero values in each column of a dataframe in python
assistant
Here is some code to count non zero values in each column in pandas data frame

df.astype(bool).sum(axis=1)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.