Let's assume we had a column called day_length which would show the total number of sunlight hours in a day.

 

data_.day_length = pd.to_timedelta(data_.day_length)

 

           day_length

Date                 

10/02/2020   09:58:53

11/02/2020   10:02:05

 

We can simply get the total number of hours with the following code:

data_.day_length / np.timedelta64(1, 'h') for hours

0     9.981389

1    10.034722

data_.day_length / np.timedelta64(1, 'm') for minutes 

0    598.883333

1    602.083333