With the following code I am expecting the dataframe (rows) to be sorted from oldest to latest timestamp. Something like this...
         #raw_dataframe#                         #sorted dataframe#
  Symbol          tagdatetime             Symbol          tagdatetime
0      A  2020-03-01 01:00:00           0      B  2020-01-01 01:00:00
1      B  2020-01-01 01:00:00   ===>    1      A  2020-03-01 01:00:00
2      C  2020-06-01 01:00:00           2      C  2020-06-01 01:00:00
But the actual output is unsorted for the following code,
import pandas as pd
df = pd.DataFrame( {'Symbol':['A','B','C'] ,
    'tagdatetime':['2020-03-01 01:00:00','2020-01-01 01:00:00','2020-06-01 01:00:00']})
print(df,"\n-------------------------------")
df['tagdatetime'] = pd.to_datetime(df['tagdatetime'], format="%Y-%m-%d %H:%M:%S").sort_values()
print(df)
Output:
      Symbol          tagdatetime
    0      A  2020-03-01 01:00:00
    1      B  2020-01-01 01:00:00
    2      C  2020-06-01 01:00:00 
    -------------------------------
     Symbol         tagdatetime
    0      A 2020-03-01 01:00:00
    1      B 2020-01-01 01:00:00
    2      C 2020-06-01 01:00:00
And I have tried many other solutions, but none seems working for me. where am I doing wrong? what happens to sort when I have two or more rows with the same timestamp?
Please answer..