Top "Multi-index" questions

A multi-index (also known as a hierarchical index) allows the manipulation of higher-dimensional data in a 2-dimensional tabular structure.

Multi-Index Sorting in Pandas

I have a multi-index DataFrame created via a groupby operation. I'm trying to do a compound sort using several levels …

python sorting pandas multi-index
Benefits of panda's multiindex?

So I learned that I can use DataFrame.groupby without having a MultiIndex to do subsampling/cross-sections. On the other …

python pandas multi-index
Pandas - write Multiindex rows with to_csv

I am using to_csv to write a Multiindex DataFrame to csv files. The csv file has one column that …

python csv pandas multi-index
How to get away with a multidimensional index in pandas

In Pandas, what is a good way to select sets of arbitrary rows in a multiindex? df = pd.DataFrame(columns=[…

python pandas multi-index
reading excel sheet as multiindex dataframe through pd.read_excel()

I'm struggle to read a excel sheet with pd.read_excel(). My excel table looks like this in it's raw …

excel pandas dataframe multi-index
Pandas setting multi-index on rows, then transposing to columns

If I have a simple dataframe: print(a) one two three 0 A 1 a 1 A 2 b 2 B 1 c 3 B 2 d 4 C 1 …

python pandas dataframe transpose multi-index
What are levels in a pandas DataFrame?

I've been reading through the documentation and many explanations and examples use levels as something taken for granted. Imho the …

python pandas dataframe multi-index
Set value multiindex Pandas

I'm a newbie to both Python and Pandas. I am trying to construct a dataframe, and then later populate it …

python pandas multi-index
Creating an empty MultiIndex

I would like to create an empty DataFrame with a MultiIndex before assigning rows to it. I already found that …

python pandas multi-index
python pandas: rename single column label in multi-index dataframe

I have a df that looks like this: df = pd.DataFrame(np.random.random((4,4))) df.columns = pd.MultiIndex.from_product([[…

python pandas rename dataframe multi-index