Skip to content
Advertisement

Error when using total_seconds to subtract two dates with different formats in Python

I have two different dates and I want to know the difference in seconds between them.

My data:

JavaScript

I want to add two column to my data frame:

JavaScript

My code:

JavaScript

This is the error:

JavaScript

Advertisement

Answer

Use .dt.total_seconds()

Ex:

JavaScript

Output:

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