xxxxxxxxxx
>>> df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
xxxxxxxxxx
df.sort_index() # Sort simple index
df.sort_index(level=['col1','col2'], # Sort multi-level / hierarchical index
ascending = [True, False])
xxxxxxxxxx
df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
xxxxxxxxxx
df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
xxxxxxxxxx
df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
xxxxxxxxxx
df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
xxxxxxxxxx
df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
xxxxxxxxxx
df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3