-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Issue with Excel writers when column names are duplicated #5235
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
@jreback - I feel like you've dealt with this recently - how do you handle |
easy when I iterate thru columns do this for i, col in enumerate(obj.columns): rather than using iteritems |
There you go - I figured you'd have an easy answer :) |
I'll try the |
gr8 |
closed by #5237 |
This was referenced Nov 4, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There appears to be an issue with Excel writers when DataFrame column names are duplicated. This issue that was initially reported on StackOverflow.
For example consider the following program:
Note the duplicated column name. The
df
for this looks like this:The corresponding output of the CSV is as expected:
However, the output of the any of the Excel writers is incorrect:
The issue appears to be in
pandas/core/format.py
. The output data is gathered based on column names, as shown below, which causes issues with duplicate names.I initially thought that this might be the correct behaviour and that column names shouldn't be duplicated but given that the output is different to the csv writer it looks like a bug.
I'll write a test case but I'm not sure of the best way to fix the issue.
The text was updated successfully, but these errors were encountered: