Skip to content
Advertisement

dataframe to long format

I have the following df:

JavaScript

I would like to change it so that looks like this:

JavaScript

The reason is that I have a df that is similarly shaped and I need to merge the two dfs. I have recently had similar df shaping issues that I have been unable to find simple quick solutions to with python. Does anyone know how to solve this kind of problem?

Advertisement

Answer

You can use melt:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement