I have a pandas dataframe with this structure:
| ID | Activity | 
|---|---|
| 1 | A | 
| 1 | A | 
| 1 | B | 
| 2 | A | 
I would like to transform it into a dataframe like this:
| ID | Activity_A | Activity_B | 
|---|---|---|
| 1 | 2 | 1 | 
| 2 | 1 | 0 | 
So making the ID column unique, and creating a separate column for each Activity, and counting the number of activities for each ID.
Thank you for your help.
I'm not sure how to start. I understand there is a get_dummies() function, but is it applicable here?
