0

I have a table with 300 rows and 200 columns and i need to transform it. I add an image of the transformation with an example table.

Example of transformation

The table above is the original. The one below is the table after the transformation.

I was trying to solve it with excel and Pandas library of Python but i could not solve it. Any ideas?

Scott Craner
  • 148,073
  • 10
  • 49
  • 81

1 Answers1

0

You can do a melt after reading excel using pandas:

df = pd.read_excel('your_excel_path')
df = pd.melt(df, id_vars='id', value_vars=['variable_1', 'variable_2'])

then write back to excel

df.to_excel('modified_excel.xlsx')
SomeDude
  • 13,876
  • 5
  • 21
  • 44