Python: Convert timedelta to int in a dataframe
Python: Convert timedelta to int in a dataframe
Execute the below code where td is the timedeltas:
import numpy as np (td / np.timedelta64(1, 'D')).astype(int)
The attributes such as .days, .seconds, and .microseconds are read only for timedelta objects.