pandas.Index.sortlevel#

Index.sortlevel(level=None, ascending=True, sort_remaining=None, na_position='first')[source]#

For internal compatibility with the Index API.

Sort the Index. This is for compat with MultiIndex

Parameters:
ascendingbool, default True

False to sort in descending order

na_position{‘first’ or ‘last’}, default ‘first’

Argument ‘first’ puts NaNs at the beginning, ‘last’ puts NaNs at the end.

New in version 2.1.0.

level, sort_remaining are compat parameters
Returns:
Index