how to sort a pandas dataframe based on datetime code example Example: python order dataframe according to date time df = df.sort_values(by='DateTime1',ascending=True)