Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas dataframe.sort_index() function sorts objects by labels along the given axis.
Basically the sorting algorithm is applied on the axis labels rather than the actual data in the dataframe and based on that the data is rearranged. We have the freedom to choose what sorting algorithm we would like to apply. There are three possible sorting algorithms that we can use ‘quicksort’, ‘mergesort’ and ‘heapsort’.
Pandas dataframe.sort_index() : https://www.geeksforgeeks.org/python-pandas-dataframe-sort_index/