I have a pandas timeframe that has a column in this time format: e.g. 05:00:00
(hour, minute, seconds). These values are extracted off my SQL database via pandas with the following query function
df = pd.read_sql("SELECT .....'" \
, con=mariadb_connection)
I would like to convert these time values into minutes (or seconds) as I would like to perform linear regression on the values which are my time duration variable. How can I go about doing that? Is there a way I can convert these values (e.g. multiply 60 to 14 of 14:30:00
and add to 30, to get the total duration in minutes i.e 870) into duration values without the :
and then place them back into the same rows and columns of the dataframe for further analysis? Currently, I cannot work with the current time format as scikit linear regression function does not accept this format into one of the function's argument.
Example dataframe:
voltage valueA Duration valueB
0 12.45 0.86 14:04:30 9.157145
1 12.52 0.61 14:02:32 10.010095
2 12.24 0.17 14:00:33 10.010095