Sorting by index in pandas means rearranging the rows of a DataFrame based on their index labels. The method sort_index() is called on the DataFrame. By default, it sorts in ascending order and returns a new DataFrame with rows reordered. The original DataFrame remains unchanged unless you specify inplace=True. You can also sort in descending order by setting ascending=False. The execution table shows the index order before and after sorting, and the variable tracker shows how the index values change in the new sorted DataFrame. Remember to assign the result back or use inplace=True to modify the original DataFrame.