Can Pandas Read Excel's Group Structure into a MultIndex?

后端 未结 3 1055
栀梦
栀梦 2021-01-15 01:10

I have an Excel file with some (mostly) nicely grouped rows. I built a fake example below.

Is there a way to get read_excel in Pandas to produce a multiindex preser

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 01:59

    I don't think it is possible to implement this using read_excel as-it.

    What you can do is to add additional columns to your excel sheet based on the four hierarchy levels (Family, Individual, Child (optional), investment) and then use read_excel() with index_col[0,1,2,3] to generate the pandas dataframe.

提交回复
热议问题