Reputation: 182
I'm trying the following example from this (closed) GitHub issue: https://github.com/pandas-dev/pandas/issues/2701
import pandas as pd
m = pd.MultiIndex.from_tuples([(1,1),(1,2)], names=['a','b'])
df = pd.DataFrame([[1,2],[3,4]], columns=m)
df.to_excel('test.xls')
When I open test.xls
, there is a blank line on row 3:
The example image from GitHub doesn't have this blank line:
Is this a bug? And are there workaround available for writing multiindex dataframes to Excel? I'd rather not go the CSV route, as pandas will do the merge-and-center for me.
Using pandas version 0.19.2 on Ubuntu 14.04 and Windows 10.
Upvotes: 1
Views: 2082
Reputation: 643
I am able to reproduce whatever you have done. This is most likely a bug. No easy way out of this but to delete that row by reading the xlsx in again. Please add this to the closed github chain and reopen it.
Upvotes: 1