API: to_excel with merge_cells=False treats index and columns differently · Issue #60274 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
df = pd.DataFrame({"a": [1, 1], "b": [2, 3], "c": 4, "d": 5}).set_index(["a", "b"]) df.columns = pd.MultiIndex.from_tuples([("x", "y"), ("x", "z")]) df.to_excel("test.xlsx", merge_cells=False)
In the above the multi-level nature of the index is maintained, however the columns are collapsed to a single row in the form x.y, x.z
. It seems to me that these should be treated the same. The output should be multiple rows of non-merged cells.