Python: convert datedelta to int value of time difference
date1
is a timedelta object - use date1.days
to get the number of days as an integer, or date1.total_seconds()
to see the number of seconds between the two datetime objects.
For me worked using Serie.dt.days
. It changes the datatype of a Serie from "timedelta" to "int" and the time difference is presented in full days.
Just reference the days
attribute of the timedelta
object you have there:
print(date1.days)
There are also timedelta.seconds
and timedelta.microseconds
attributes, modeling the complete delta state.