I try to split a column of text strings which contains comma-separated values (Genres by Song). For further analysis I need every value of the string in a new row. I am new to python. Managed to import the excel in a pandas dataframe. Couldn't find an example of my problem on stack.
df:
| Song Title | Genres | Length |
|---|---|---|
| Song1 | HipHop, Rap | 3:30 |
| Song2 | Rock, Metal,Hard Rock | 2:55 |
| Song3 | Jazz | 4:00 |
What I try to achieve:
| Song Title | Genres | Length |
|---|---|---|
| Song1 | HipHop | 3:30 |
| Song1 | Rap | 3:30 |
| Song2 | Rock | 2:55 |
| Song2 | Metal | 2:55 |
| Song2 | Hard Rock | 2:55 |
| Song3 | Jazz | 4:00 |