Skip to content
Advertisement

Multiple dates in a pandas column

I am trying to make the dates in a Pandas DataFrame all of the same format. Currently I have the DataFrame storing the dates in two formats.

“6/08/2017 2:15:00 AM” & 2016-01-01T00:05:00

The column name which these dates are stored under is INTERVAL_END. As you can see, one of the dates is a string, and the other is a formatted date.

I have tried to format the dates based on what they currently are using this:

JavaScript

Any help of this would be great thanks!

Advertisement

Answer

You should be able to just .str.strip('"') the column before converting to_datetime().

Toy example:

JavaScript

Then convert the stripped column to_datetime():

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement