Index.
argsort
Return the integer indices that would sort the index.
Passed to numpy.ndarray.argsort.
Integer indices that would sort the index if used as an indexer.
See also
numpy.argsort
Similar method for NumPy arrays.
Index.sort_values
Return sorted copy of Index.
Examples
>>> idx = pd.Index(['b', 'a', 'd', 'c']) >>> idx Index(['b', 'a', 'd', 'c'], dtype='object')
>>> order = idx.argsort() >>> order array([1, 0, 3, 2])
>>> idx[order] Index(['a', 'b', 'c', 'd'], dtype='object')