Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Pandas exporting to Excel (xls, xlsx) with multilevel columns #11408
Comments
|
@dinya Thanks for the report! It is always easier if you provide an easier reproducible example (as we cannot run your code above), but I made a small one:
Can you see if this reproduces your issue? I can't reproduce it with 0.17.0, but I was using openpyxl 1.6.1 |
jorisvandenbossche
added the
IO Excel
label
Oct 22, 2015
dinya
commented
Oct 22, 2015
|
@jorisvandenbossche, I run your code and get the following:
|
jorisvandenbossche
added the
Bug
label
Oct 22, 2015
jorisvandenbossche
added this to the
0.17.1
milestone
Oct 22, 2015
|
Yes, I can confirm it with a more recent version of |
|
cc @chris-b1 another multi-index one |
|
I just tested this with Python 3.4.3, pandas 0.17.0, xlsxwriter 0.7.3, and openpyxl 1.8.5 and cannot replicate. I tested with Python 3.4.3, a dev copy of pandas, xlsxwriter 0.7.6, and openpyxl 2.0.2 and cannot replicate. I tested with Python 2.7.10, a dev copy of pandas, xlsxwriter 0.7.6, and openpyxl 1.6.2, and cannot replicate. However, I tested with Python 2.7.10, a dev copy of pandas, xlsxwriter 0.7.6, and openpyxl 2.3, and I do replicate. I wonder it this relates to my pull request and different behaviors based on python/openpyxl combinations detailed here (scroll to the bottom): pydata#11328 @chris-b1 would like your opinion |
|
I found the bug in pandas/io/excel.py:_Openpyxl22Writer.write_cells and have fixed it in my branch that is in the pull request pydata#11328 . So if one of you guys (@chris-b1, @jreback ) will answer my question there, I'll do a commit and fire off the tests and this bug can be put to rest. |
|
@dinya If you use a version of openpyxl earlier than 2.2, then your problem will disappear with pandas 0.17.0 . |
Dr-Irv
added a commit
to Dr-Irv/pandas
that referenced
this issue
Oct 22, 2015
|
|
Dr-Irv |
4541c37
|
Dr-Irv
referenced
this issue
Oct 23, 2015
Closed
Fix for BUG: multi-index excel header fails if all numeric #11328
Dr-Irv
added a commit
to Dr-Irv/pandas
that referenced
this issue
Oct 24, 2015
|
|
Dr-Irv + Dr-Irv |
4f62b99
|
jreback
added a commit
that referenced
this issue
Oct 25, 2015
|
|
Dr-Irv + jreback |
d5a04c1
|
|
closed by #11328 |
dinya commentedOct 22, 2015
Hello all,
I want collect few tables into the one with pandas. I use the code presented below:
Source data is

x.xlsxand

y.xlsxfiles.XLS engine works well (

merged_xls.xls):But something is wrong (cells merging) with XLSX engine (

merged_xlsx.xlsx):Manual cells unmerging works in Excel:

Is it bug in XLSX pandas engine (openpyxl)? Or what is wrong in my code?
Versions:
python-2.7.10,pandas-0.17.0,openpyxl-2.3.0.P.S. This issue is copy of my question on stackoverflow. It was suggested as bug and was adviced to post here.