In Python imagine I have this as my dataframe, a list of songs and their groups
Song Title | Category |
---|---|
Hello | Pop |
Night Fever | Rock |
Dancing | Pop |
My Star | Metal |
I want to be able to transform all the values under "category" into a new dataframe, so the values are columns, and under each column, it lists the songs. See below for desired outcome...
Pop | Rock | Metal |
---|---|---|
Hello | Night Fever | My Star |
Dancing |
I'm sure theres a simple code for this in either pyhton or pandas, any help would be appreciated.
Thanks