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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors