Closed
Description
link to #1651
Saving a multiindex column to_excel saves a sparse index.
Migrated from this StackOverflow question, with a smaller DataFrame.
In [1]: m = MultiIndex.from_tuples([(1,1),(1,2)], names=['a','b'])
In [2]: df = DataFrame([[1,2],[3,4]], columns=m)
In [3]: df
Out[3]:
a 1
b 1 2
0 1 2
1 3 4
In [4]: df.to_excel('test.xls')
Saves the xls:
1.1 .2
0 1 2
1 3 4
This differs from how to_csv
(which is not sparse):
,"(1L, 1L)","(1L, 2L)"
0,1,2
1,3,4