1# Basic syntax:
2(pandas_dataframe == 0).sum(axis=1)
3# Where axis 1 specifies that sum will operate on rows. Use 0 for columns
4
5# Example usage:
6# Create Pandas dataframe:
7import pandas as pd
8pandas_dataframe = pd.DataFrame({'a':[1,0,0,1,3],
9 'b':[0,0,1,0,1],
10 'c':[0,0,0,0,0]})
11 a b c
120 1 0 0
131 0 0 0
142 0 1 0
153 1 0 0
164 3 1 0
17
18(pandas_dataframe == 0).sum(axis=1)
190 2
201 3
212 2
223 2
234 1