-1

I have a lab report in excel which contain multiple level of header and multiple variables as well,

enter image description here

I'd like to unpivot it to a flat table with pandas into the format shown as in the picture below, can someone help?

enter image description here

SCTongYe
  • 5
  • 3
  • 3
    Don't use images, instead add code that creates a sample of your input dataframe. [See this post](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples?answertab=oldest#tab-top) – Scott Boston Oct 08 '19 at 15:01

1 Answers1

0

You can read it into a dataframe, see exactly how in this answer: reading excel sheet as multiindex dataframe through pd.read_excel()

And then stack your dataframe with df.stack().

Hadas Arik
  • 58
  • 4