1

I am having date field like(reading from a csv file) :

Date:
28 Apr 2020
29 Apr 2020
12 Mar 2020
11 Mar 2020
9 Mar 2020

was trying to sort the value by date like:

df = df.sort_values(by=['Date'])

But it was not working. So I converted it to pandas datetime format like:

df['Date'] = pd.to_datetime(df.Date)

and then sort the column like:

df = df.sort_values(by=['Date'])

the sort is working fine, but I would like to covert the Date column back to the original format

0 Answers0