{"id":6655,"date":"2021-05-22T09:06:40","date_gmt":"2021-05-22T03:36:40","guid":{"rendered":"https:\/\/python-programs.com\/?p=6655"},"modified":"2021-11-22T18:45:25","modified_gmt":"2021-11-22T13:15:25","slug":"pandas-sort-a-dataframe-based-on-column-names-or-row-index-labels-using-dataframe-sort_index","status":"publish","type":"post","link":"https:\/\/python-programs.com\/pandas-sort-a-dataframe-based-on-column-names-or-row-index-labels-using-dataframe-sort_index\/","title":{"rendered":"Pandas : Sort a DataFrame based on column names or row index labels using Dataframe.sort_index()"},"content":{"rendered":"

Sorting a DataFrame based on column names or row index labels using Dataframe.sort_index() in Python<\/h2>\n

In this article we will discuss how we organize the content of data entered based on column names or line reference labels using Dataframe.sort_index ().<\/code><\/p>\n

Dataframe.sort_index():<\/h3>\n

In the Python Pandas Library, the Dataframe section provides a member sort sort_index () to edit DataFrame based on label names next to the axis i.e.<\/p>\n

DataFrame.sort_index(axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True, by=None)<\/pre>\n

Where,<\/p>\n