Multi-Index¶
In [ ]:
pd.MultiIndex.from_product([[jj.index.name], jj.index.values])
Get Levels¶
In [ ]:
get_level_values
In [ ]:
it seems to me that there are even easier ways sometimes ...
Extract columns whose 2nd-level index is bi
from the data frame df
.
In [ ]:
df.loc(axis=1)[:, "bi"]
References¶
https://www.youtube.com/watch?v=tcRGa2soc-c
https://pandas.pydata.org/pandas-docs/stable/advanced.html
https://jakevdp.github.io/PythonDataScienceHandbook/03.05-hierarchical-indexing.html
http://www.legendu.net/misc/blog/python-pandas-multiindex-add-level/
http://www.legendu.net/misc/blog/python-pandas-multiindex-construct/
In [ ]: