What does cannot index with multidimensional key mean? Tried to change avg_wins.ix to avg_wins.loc but no luck. How do I correct this issue?

  • 1
    Where are you seeing this error? What is the code you're using? May 13, 2019 at 18:31

1 Answer 1


It looks like this is from pandas or dask. It pops up when you try to .loc (locate) from a pd.DataFrame or dd.DataFrame, which has a MultiIndex column.

Your output should look like this:


MultiIndex([(           'A', 'first'),
            (           'B', 'first'),
            (           'C', 'mean')])

and so on. Otherwise it will simply output a flat list of columns.

So in a MultiIndex you can do different things, but what helps is to know how you can .loc (locate/filter) pretty easy:


will give you that column and

df.loc[df['A','first'] == 5]

let you filter over a MultiIndex column.

Dask: MultIndex is used as default in dask groupby functions, when using multiple aggregate functions for one column, like this:

my_aggregate = {
    'A': 'first',
    'B': 'first',
    'C': ['mean','last'],

TL;DR: Look for a pandas/dask MultiIndex column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.