I am getting the time delta in seconds and dividing it by 3600 to get hours
round(td.total_seconds() / 3600)
.
When I tested in jupyter notebook this approach works faster
%timeit td / np.timedelta64(1, 'h')
The slowest run took 19.10 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 4.58 µs per loop
%timeit round(td.total_seconds() / 3600)
The slowest run took 18.08 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 401 ns per loop