I would like to process with the grouped dataset below (the command lead to the below result is df.groupby(['ids','category'])['counts'].sum())
ids|category|counts
1 A 3
2 B 5
3 A 1
B 1
C 1
4 C 3
What I am trying to get is below (every unique id with one row so that I can merge with another data table later):
ids|A_n|B_n|C_n
1 3 0 0
2 0 5 0
3 1 1 1
4 0 0 3
Is this possible? Any thoughts are welcome, thank you in advance!