I have a column of dates in the format 2019-11-04 00:33:15 UTC
that I need to format into 04/11/19 hh:mm:ss
. I've tried this:
df1["date"]= pd.to_datetime(df1["date"])
But it's returned NaT
in all entries. I don't know what I'm doing wrong!!
You can use this to easily convert the format. I hope this helps you.
date = [["2019-11-04 00:33:15"],["2019-11-14 00:43:15"],["2019-11-25 06:33:15"],["2019-11-27 09:33:15"]]
df = pd.DataFrame(date, columns = ['Date'])
df['Date'] = pd.to_datetime(df['Date']).dt.strftime('%d/%m/%Y %H:%M:%S')
print(df)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments