How to convert pandas Timedelta to seconds
TL;DR
Use
my_timedelta / np.timedelta64(1, 's')
Full example
import pandas as pd
import numpy as np
import time
# Create timedelta
t1 = pd.Timestamp("now")
time.sleep(3)
t2 = pd.Timestamp("now")
my_timedelta = t2 - t1
# Convert timedelta to seconds
my_timedelta_in_seconds = my_timedelta / np.timedelta64(1, 's')
print(my_timedelta_in_seconds) # prints 3.00154