I have a data frame extract from excel file with a date. The original date in excel is in this format (dd/mm/yyyy)
20/05/2020
but, in my code, if I print the date column, the format date is changed (yyyy-mm-dd)
2020-05-20
When I copy the dataframe in another preformatted sheet excel, the date has converted in yyyy/mm/dd hh:mm:ss
2020-05-20 00:00:00
In the preformatted sheet, the date column is setting with format "dd/mm/yyyy".
I have try to use the to_datetime, but this not work for me.
df.Workdate = pd.to_datetime(df.Workdate.dt.strftime('%d/%m/%Y'))
or
df['Workdate'] = pd.to_datetime(df['Workdate'], format='%d/%m/%Y')
The result not change, if I print the df, the date have every the same format yyyy-mm-dd (in excel yyyy-mm-dd hh:mm:ss).
Where am i wrong?
Regards, Marco