-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

1
  • 3
    Don't use images, instead add code that creates a sample of your input dataframe. See this post Commented Oct 8, 2019 at 15:01

1 Answer 1

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().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.