For example, I have my data in the following form:
    Group Product
0      1       A
1      1       A
2      1       B
3      2       A
4      2       B
5      2       C
6      3       A
7      3       C
8      3       C
What I would like to achieve is having it be like the following:
   Group  A  B  C
0      1  2  1  0
1      2  1  1  1
2      3  1  0  1
Where values of A, B and C columns are respectively their occurences for the given group.
How can I achieve this using pandas?
I tried using groupby and count with the following code
df.groupby(['Group','Product'])['Product'].count()
Which provided me with the results I wanted however I have no idea how to put them into seperate columns for each count.
 
     
    