I have this dataframe:
    code
0   0000
1   0000  
2   0123  
3   0123
4   4567
I want to groupby code and count how many of each code there is in the dataframe, so it get to look like this:
   code  count     
0  0000      2 
1  0123      2
2  4567      1
I was using: group=df.groupby('code').agg('count') However I wasn't getting it right.
Can someone help?
 
    