Closed
Description
This is an issue that I introduced when fixing #5235.
The cols
option in to_excel
no longer works correctly after the fix for the above issue. For example:
import pandas as pd
df = pd.DataFrame({'A': ['a', 'a', 'a'],
'B': ['b', 'b', 'b']})
df.to_excel('frame.xlsx', sheet_name='Sheet1', cols=['B', 'A'])
Gives:
Note, the headers are changed but not the column data.
I have a proposed fix and test for this. Should I create a new branch/PR or merge it into the Excel MultiIndex PR: #5423