I have a dataframe:
id value
A 1
A 0
A 1
B 1
B 1
C 0
I'm trying to group by id and count occurances in value column such that I count no. of ones and no. of 0's in each group:
id No. of 1's No of 0's
A 2 1
B 1 0
C 0 1
I know of a way to groupby and use aggregate function
df.groupby('id').agg({'value': xxx})
But i think there should be a much better way to do this.