1

I have following code:

import pandas as pd

current_date = pd.Timestamp.now() #2018-08-17 16:05:53.842894
created_date = pd.to_datetime("2018-07-23 09:52:06.090000")
diffrence = (pd.Timedelta(current_date - feed_created_date).seconds)
print(diffrence)
#output is - 22427

The ideal output should be 2,182,487. I am not able to findout why this is giving the incorrect output or I am doing something wrong.

Any help will be appreciated. Thanks in advance.

Bhuneshwer
  • 577
  • 1
  • 9
  • 26

1 Answers1

2

The problem is that the seconds is an attribute with value between >= 0 and less than 1 day. Use total_seconds() instead:

diffrence = (pd.Timedelta(current_date - created_date).total_seconds())
Joe
  • 12,057
  • 5
  • 39
  • 55