-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DataFrame.to_excel(index=False) misplaces data/columns in MultiIndex case #5616
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
Comments
Thanks for the bug report. Can you post what version of pandas and xlwt you
|
@jtratner it's |
Can you run Regardless, definitely a bug that needs to be fixed, but I'm guessing it |
@jtratner Well, that's the thing - I cannot access git due to SSL restrictions, proxies etc on a remote box at work, hence I had to download a zip of the master branch. Obviously then, |
it's supposed to fall back on using the hard-coded major/minor version. On Mon, Dec 2, 2013 at 12:09 PM, Ivan Smirnov [email protected]:
|
Adding a comment to track this issue. |
Mea culpa. My Excel multi-index changes introduced this bug. I've pushed a fix and test. |
Output after fix: >>> import pandas as pd
>>>
>>> df = pd.DataFrame({'a': [10, 20], 'b': [30, 40], 'c': [50, 60]},
... index=pd.MultiIndex.from_tuples([(70, 80), (90, 100)]))
>>> writer = pd.ExcelWriter('test.xls')
>>> df.to_excel(writer, sheet_name='1', index=False)
>>> writer.save()
>>>
>>> pd.read_excel('test.xls', '1')
a b c
0 10 30 50
1 20 40 60 |
Example:
The column names are obviously misplaced (erroneously shifted to the right by the number of levels in the MultiIndex). Or is it the data that is misplaced? Wonder why no one noticed this before.
The text was updated successfully, but these errors were encountered: