Skip to content
Advertisement

Tag: export-to-excel

How to export pandas dataframe with Multi-index columns to Excel with column name in one level unmerged and column name in another level merged?

I have a pandas dataframe df which looks as follows: The columns are Multi-Index consisting of 3 levels. First level has Germany as country. Second level has some indicators, and third level has years. And there are some data in the pandas dataframe. I’d like to export this dataframe to Excel such that I get Germany in each column. Then

Advertisement