Skip to content
Advertisement

Python Dataframe find difference between datetime rows and convert to seconds

I have a data frame with the DateTime index. I want to find the difference between row datetimes and convert it into seconds. My code:

JavaScript

Present output:

JavaScript

How do I convert the timedif column into total seconds?

Advertisement

Answer

Simply do:

JavaScript

Example:

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