Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Pivot/Unstack Pandas Dataframe Data

Grateful for your help. Sorry, could not figure this out as I wasn’t sure if I’m pivoting or unstacking.

My data looks like this:

Email Col1 Col2 Col3
si@si A 2 D
ad@ad A 5 C

I’m looking to pivot this to:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

si@si ad@ad
Col1 A A
Col2 2 5
Col3 D C

Thanks so much!

>Solution :

Transpose the dataFrame.

df.set_index('Email').rename_axis(None).T
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading