After exporting MultiIndex DataFrame to an Excel file, an additional row between the header and the rows is created. How can I avoid that?
writer = pd.ExcelWriter(out_xlsx, engine='xlsxwriter')
df1.to_excel(writer, sheet_name='All Instances', merge_cells=True)
Did anyone experience similar behaviour?
That is a known issue/feature in Pandas. See this GitHub Issue for an explanation.
This Stack Overflow answer is probably the best workaround I’ve seen.