I have a dataframe, e.g:
Date B C 20.07.2018 10 8 20.07.2018 1 0 21.07.2018 0 1 21.07.201
I believe need DataFrameGroupBy.agg with compare by 0 and sum:
0
sum
df1 = df.groupby('Date').agg(lambda x: x.eq(0).sum()) print (df1) B C Date 20.07.2018 0 1 21.07.2018 1 1
df2 = df.groupby('Date').agg(lambda x: x.ne(0).sum()) print (df2) B C Date 20.07.2018 2 1 21.07.2018 1 1