You can check docs:
We’ve “sparsified” the higher levels of the indexes to make the console output a bit easier on the eyes. Note that how the index is displayed can be controlled using the multi_sparse option in pandas.set_options():
df = pd.DataFrame({'A':list('abcaac'),
'F':list('aaabbb'),
'B':[4,5,4,5,5,4],
'C':[7,8,9,4,2,3],
}).set_index(['A','F'])
print (df)
B C
A F
a a 4 7
b a 5 8
c a 4 9
a b 5 4
b 5 2
c b 4 3
#change default value multi_sparse == True
with pd.option_context('display.multi_sparse', False):
print(df)
B C
A F
a a 4 7
b a 5 8
c a 4 9
a b 5 4
a b 5 2
c b 4 3
So if want see grouped all levels is possible sorting by sort_index
:
print (df.sort_index())
B C
A F
a a 4 7
b 5 4
b 5 2
b a 5 8
c a 4 9
b 4 3
#change default value multi_sparse == True
with pd.option_context('display.multi_sparse', False):
print(df.sort_index())
B C
A F
a a 4 7
a b 5 4
a b 5 2
b a 5 8
c a 4 9
c b 4 3