Skip to content

BUG: Excel writer doesn't handle "cols" option correctly #5427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmcnamara opened this issue Nov 4, 2013 · 1 comment · Fixed by #5429
Closed

BUG: Excel writer doesn't handle "cols" option correctly #5427

jmcnamara opened this issue Nov 4, 2013 · 1 comment · Fixed by #5429
Labels
API Design Bug IO Excel read_excel, to_excel
Milestone

Comments

@jmcnamara
Copy link
Contributor

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:

screenshot

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

@jtratner
Copy link
Contributor

jtratner commented Nov 4, 2013

If this is small, might want to do it separately so it can be merged before MI PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants