So I have a column in a dataframe, which stores datetime in this format '2016-04-29T00:00:00Z'. Also the type is string, I would like to convert this to pandas datetime using pd.to_datetime(df['column_name'], format="YYYY-MM-DDTHH:mm:ssZ")
. Can you please provide the correct format for this. I am getting this error.
Asked
Active
Viewed 15 times
0

FObersteiner
- 22,500
- 8
- 42
- 72

Asif Ahmed
- 11
-
You can use `pd.to_datetime(df['column_name'])` – jezrael Feb 03 '22 at 06:06
-
btw. the format you have is based on [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) – FObersteiner Feb 03 '22 at 19:52