I have a dataset that has information like below:
Title Year Revenue (Mi) --------------------------------------------------------------- Guardians of the Galaxy 2015 313.13 Split 2016 138.0 Sing 2016 270.32 Moana 2015 248.02
I want to convert this piece of data to this form:
Title 2015 2016 ------------------------------------------------------------ Guardians of the Galaxy 313.13 Split 138.02 Sing 270.32 Moana 248.02
How can I convert my data frame to this form ?? I am not getting what should I do in this case.
Try with
out = df.pivot(index='Title', columns='Year', values='Revenue (Mi)').reset_index()
1.4m articles
1.4m replys
5 comments
57.0k users