I have several columns in a pd.DataFrame in which decimal separates hours and minutes (e.g., 3.15 = 3 hours, 15 minutes). Is there a quick way to convert this so that the data are recognized as h.m ? The pandas Time Series documentation doesn't seem to apply to my case. I don't have or want to attach any dates.
I tried:
# create df
hour_min = pd.DataFrame({'a': [4.5, 2.3, 3.17],
'b': [2.12, 1.13, 9.13],
'c': [8.23, 9.14, 7.45]})
# convert to hours
hour_min.astype('timedelta64[h]')
which gives
a b c
0 04:00:00 02:00:00 08:00:00
1 02:00:00 01:00:00 09:00:00
2 03:00:00 09:00:00 07:00:00
but I want
a b c
0 04:50 02:12 08:23
1 02:30 01:13 09:14
2 03:17 09:13 07:45
I also need the following type of result from adding/subtracting column values 1.32 + 1.32 = 3.04