I have a multilevel dataframe df :
>>> df
sales cash
STK_ID RPT_Date
000568 20120630 51.926 42.845
20120930 80.093 57.488
000596 20120630 22.278 18.247
20120930 32.585 26.177
000799 20120630 9.291 6.513
20120930 14.784 8.157
And I want to get the value list of sub_level index 'STK_ID' , which will return a list of ['000568','000596','000799'].
Is there any direct function to do this (without using reset_index and getting the column value)?
You are looking for
index.levels:Note you can see the index names:
These are discussed in the docs here.