DataFrame.sort_index(axis=0, by=None, ascending=True, inplace=False, kind='quicksort')

Sort DataFrame either by labels (along either axis) or by the values in a column

Parameters :

axis : {0, 1}

Sort index/rows versus columns

by : object

Column name(s) in frame. Accepts a column name or a list or tuple for a nested sort.

ascending : boolean or list, default True

Sort ascending vs. descending. Specify list for multiple sort orders

inplace : boolean, default False

Sort the DataFrame without creating a new instance

Returns :

sorted : DataFrame


>>> result = df.sort_index(by=['A', 'B'], ascending=[1, 0])