I've had a good hunt for some time and can't find a solution so asking here.
I have data like so:
Plan | Quantity_y
Starter | 1
Intermediate | 1
Intermediate | 1
Intermediate | 2
Intermediate | 1
Intermediate | 14
Intermediate | 1
Advanced | 1
Advanced | 1
Advanced | 2
Advanced | 1
Incredible | 1
Incredible | 1
Incredible | 1
Incredible | 1
Incredible | 1
Incredible | 2
Incredible | 2
and I'd like it to group AND count the individual numbers like so:
Plan | Quantity_y
Starter | 1
Intermediate | 20
Advanced | 5
Incredible | 9
I've tried so many options but am having no luck at all.
I've tried doing an iterrows()
as well as trying to assign a value by counting and returning the count via a .apply()
function call. I'm just not getting how I can group AND count the sum of the numbers in that group.
Any advice would be appreciated.
Thank you