Q:

Need to convert datetime to dd/mm/yyyy

In my csv file, I have date column as dd/mm/yyyy. However, when I import it into Python 3, it automatically changes the entire column to yyyy/mm/dd and its data type is an object.
I have tried converting it back to dd/mm/yyyy with this:
datetime.datetime.strptime(df_sales_sum['Date'], "%Y/%m/%d").datetime.strftime("%d-%m-%Y")

However, it returned me with this

TypeError: strptime() argument 1 must be str, not Series

Am i supposed to convert the df_sales_sum['Date'] part to a string first? And from what I know, datetime automatically converts it to yyyy/mm/dd. Correct me if im wrong.
Any help on converting it from yyyy/mm/dd to dd/mm/yyyy will be appreciated

A:

Yes, I would make df_sales_sum['Date'] a string: str(df_sales_sum['Date']). See if that helps. However, I'm not sure what df_sales_sum['Date'] output is.
df_date = str(df_sales_sum['Date'])

convert_date = df_date.strftime("%d/%m/%Y")

Good luck.

