split column values into separate rows (pivot)

I have a dataset that looks like this:

App    Downloads    Permissions
A      123          56
B      89           12

I want to modify the dfto look like like this:

App    Title              Value    
A      Downloads          123
A      Permissions        56
B      Downloads          89
B      Permissions        12

How can I achieve this? I have looked into the pivot_table functions but it seems a bit different than what I am trying to achieve. Also, not sure how to add the names (Title/Value) for the new columns I want to create

>Solution :

You could use melt to get these results

df.melt(value_vars = ['Downloads', 'Permissions'])

Leave a Reply