ENH: read_excel MultiIndex #4679 by chris-b1 · Pull Request #10967 · pandas-dev/pandas (original) (raw)

You roundtrip by assuming 'a' is the index name, (because there would be an all blank row if it wasn't), which is what csv does too.

In [199]: df = pd.read_csv(
    ...: StringIO(""",foo,foo,bar,bar
    ...: ,a,b,a,b,
    ...: a,,,,
    ...: b,1,2,3,4
    ...: a,5,6,7,8"""), index_col=0, header=[0,1])

In [200]: df.index
Out[200]: Index([u'b', u'a'], dtype='object', name=u'a'