Give it a try
working.sort_index()
Out[702]:
country name
first 0 Albania Jeff
second 1 Zimbabwe Fred
or more specifically
working.sort_index(level=[0, 1], ascending=[True, False])
EDIT. Your labels with multiple indexes are shown below.
not_working.index
Out[565]:
MultiIndex(levels=[['second', 'first'], [0, 1]],
labels=[[0, 1], [1, 0]])
working.index
Out[566]:
MultiIndex(levels=[['first', 'second'], [0, 1]],
labels=[[1, 0], [1, 0]])
So, if you want to sort not_working:
not_working.sort_index(level=[0, 1], ascending=[False, False])
Out[567]:
country name
first 0 Albania Jeff
second 1 Zimbabwe Fred
source
share