from datetime import datetime
my_dates = ['5-Nov-18', '25-Mar-17', '1-Nov-18', '7-Mar-17']
my_dates.sort(key=lambda date: datetime.strptime(date, "%d-%b-%y"))
print(my_dates)
# Sort the dataframe 'df' by the column 'dateColumn'
df = df.sort_values(by=["dateColumn"])
# -- or --
df.sort_values(by=["dateColumn"], inplace=True, ascending=True)
# Sort by multiple columns
df.sort_values(by=['col1','col2'],ascending=[True,False])
from datetime import datetime
my_dates = ['5-Nov-18', '25-Mar-17', '1-Nov-18', '7-Mar-17']
my_dates.sort(key=lambda date: datetime.strptime(date, "%d-%b-%y"))
print(my_dates)
# Sort the dataframe 'df' by the column 'dateColumn'
df = df.sort_values(by=["dateColumn"])
# -- or --
df.sort_values(by=["dateColumn"], inplace=True, ascending=True)
# Sort by multiple columns
df.sort_values(by=['col1','col2'],ascending=[True,False])