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 timedeltas of 1 hour fit it:

import numpy np  >> td / np.timedelta64(1, 'h') 26.0 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -