-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: excel export merge margin #12453
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
try |
cc @chris-b1 |
Something going awry in the logic here when there's an empty level, I'll take a look. |
I have just opened PR for this. The only problem could be, that empty name is changed to Unnamed x_level_y when reading back form excel. |
I think the expected output above is wrong
This is correct (as pandas prints it in the console)
|
Have you been referring to my PR? If yes, is it ok to change behavior so that empty index names would stay empty instead "Unnamed: %d_level_%d" as it is right now? |
yes I referred to the PR. My point is that the example in the issue is wrong. |
Sorry, but I am still not sure if I fully understand what you are saying. The html table in first comment looks exactly as yours. And the one in the comment from 27th February is wrong, although I get correct output when calling df.to_html(). Running it after applying my PR would yield:
The problem is that "Unnamed" cells are not merged and we get more Indexes on the 3rd level. I have tried to empty strings insted of "Unnamed" cells. Some tests have failed -> test_unnamed_columns as the column names have to be unique. We could count the number of empty cells and use the "Unnamed cells" only if there is more of them or be Ok with having "Unnamed" cells all the time. Do you have any other sugestions, or should I try implementing one of mentioned? |
@brandys11 The tables are not the same, salary is misplaced in the top table. The top row is 1 column off. As far as your PR, you have something wrong. You should't have any unnamed columns. This conversation should move to the PR itself, not the issue. |
Sorry, but I'm not fully understanding. Is it a bug or am I doing something wrong? |
Code Sample, a copy-pastable example if possible
Expected Output
But when exporting to Excel, the Month 2, on SALARY and DAYS, merges with the next column and All above.
2014 .......... | All ...........|
1 ..... | 2 ....................... |
15 ... | 5 ..... | 8.333333 |
When exporting to HTML it's ok with the header but, if the value cell has no value then shows cuts the columns.
output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 2012ServerR2
machine: AMD64
processor: Intel64 Family 6 Model 47 Stepping 2, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.17.1
nose: None
pip: 8.0.2
setuptools: 20.1.1
Cython: None
numpy: 1.10.4
scipy: 0.17.0
statsmodels: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: None
xlsxwriter: 0.8.4
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: None
None
The text was updated successfully, but these errors were encountered: