-
-
Notifications
You must be signed in to change notification settings - Fork 19k
Closed
Labels
EnhancementIO DataIO issues that don't fit into a more specific labelIO issues that don't fit into a more specific labelIO Excelread_excel, to_excelread_excel, to_excelOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string
Milestone
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
Metadata
Metadata
Assignees
Labels
EnhancementIO DataIO issues that don't fit into a more specific labelIO issues that don't fit into a more specific labelIO Excelread_excel, to_excelread_excel, to_excelOutput-Formatting__repr__ of pandas objects, to_string__repr__ of pandas objects, to_string