python - Get total number of hours from a Pandas Timedelta? -
how can total number of hours in pandas timedelta?
for example:
>>> td = pd.timedelta('1 days 2 hours') >>> td.get_total_hours() 26
note: per documentation, .hours
attribute return hours component:
>>> td.hours 2
just find out how many timedelta
s of 1 hour fit it:
import numpy np >> td / np.timedelta64(1, 'h') 26.0
Comments
Post a Comment