Pandas Sort Index Values in descending order
Sort Index in descending order:
import pandas as pd df = pd.DataFrame({'DateOfBirth': ['1986-11-11', '1999-05-12', '1976-01-01', '1986-06-01', '1983-06-04', '1990-03-07', '1999-07-09'], 'State': ['NY', 'TX', 'FL', 'AL', 'AK', 'TX', 'TX'] }, index=['Jane', 'Pane', 'Aaron', 'Penelope', 'Frane', 'Christina', 'Cornelia']) print(df.sort_index(ascending=False))
C:\pandas>python example.py DateOfBirth State Penelope 1986-06-01 AL Pane 1999-05-12 TX Jane 1986-11-11 NY Frane 1983-06-04 AK Cornelia 1999-07-09 TX Christina 1990-03-07 TX Aaron 1976-01-01 FL C:\pandas>
2018-10-17T01:11:56+05:30
2018-10-17T01:11:56+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution