For my dataset:
df = pd.DataFrame({'ID': [1, 1, 2, 2, 2, 2, 3],
'Month': ['Feb', 'March', 'Feb', 'Feb', 'March', 'March', 'May']})
I want to aggregate a data set by ID and its month so I get the counts per month and the total sum over all periods:
ID Month
1 Feb
1 March
2 Feb
2 Feb
2 March
2 March
3 May
I need following output:
ID Month count total_sum
1 Feb 1 2
1 Marc 1 2
2 Feb 2 4
2 March 2 4
3 May 1 1