1

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:

blank line in dataframe

The example image from GitHub doesn't have this blank line:enter image description here

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.