Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Anonymous
Not applicable

Unpivoting with Multi-Header Columns Using Python

Hello,

 

I had posted about this topic earlier but I realized that while the Power Query solution works, it's not ideal for large data sets. My .pbix file keeps crashing so I am hoping I can solve this with Python. Here is the link to the earlier post with screenshots of my data and how it should look: https://community.powerbi.com/t5/Desktop/Unpivoting-with-Multi-Header-Columns/m-p/886699#M425018

 

I'm hoping to get my data set to transpose/pivot/unpivot with Python. Alternatively, what could be the best way to address this problem.

 

Thank you in advance for your help!

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could try melt() function in Python.

Here is the link for your reference.

https://dfrieds.com/data-analysis/melt-unpivot-python-pandas

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could try melt() function in Python.

Here is the link for your reference.

https://dfrieds.com/data-analysis/melt-unpivot-python-pandas

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.