In [2]:
df.set_index(['A','C'], inplace=True)
df
Out[2]:
B D
A C
5 4 b 4.0
3 2 b NaN
4 3 a 2.0
1 2 a 3.0
2 1 B 1.0

Sort by row index

In [3]:
df.sort_index()
Out[3]:
B D
A C
1 2 a 3.0
2 1 B 1.0
3 2 b NaN
4 3 a 2.0
5 4 b 4.0

Sort multiindex

In [4]:
df.sort_index(level=1)
Out[4]:
B D
A C
2 1 B 1.0
1 2 a 3.0
3 2 b NaN
4 3 a 2.0
5 4 b 4.0
In [5]:
df.sort_index(level=1, sort_remaining=False)
Out[5]:
B D
A C
2 1 B 1.0
3 2 b NaN
1 2 a 3.0
4 3 a 2.0
5 4 b 4.0

Sort by column index

In [6]:
df.reset_index(level=['A','C'],inplace=True)
df
Out[6]:
A C B D
0 5 4 b 4.0
1 3 2 b NaN
2 4 3 a 2.0
3 1 2 a 3.0
4 2 1 B 1.0
In [7]:
df.sort_index(axis=1)
Out[7]:
A B C D
0 5 b 4 4.0
1 3 b 2 NaN
2 4 a 3 2.0
3 1 a 2 3.0
4 2 B 1 1.0