I have the following dataframe -
id count category class
1 1 A X
1 10 B X
1 2 B X
2 3 A Y
3 5 A Z
3 6 A Z
I want to sum all the occurences of 'value' based on the 'category' that it belongs to, for each ID. And then get all the categories as separate columns. I also want to leave the fourth column as is. So, I want to get something like this-
id A B class
1 1 12 X
2 3 0 Y
3 11 0 Z
I've tried messing around with trying to get dummy variables and using groupby
but I can't figure it out. Any suggestions?