I have some data imported from an XLS file that has 2 columns containing time information in the format of strings. Example: 04:15:45 (which means 4 hours, 15 minutes, and 45 seconds).
Next I convert it to datatime
df['column'] = pd.to_datetime(df['column'], errors='coerce')
I get something like this 2019-01-09 04:15:45
which is not exactly what I want, but that's okay ( I rather have it in the format %H%M%S). I do the same thing with another column with the same characteristics.
Next I create a new column with the difference between them:
df['new column'] = df['column1'] - df['column2']
However when I try to subtract both I get results like this: -1 days +23:00:00
when all I really want is something like 00:16:12
, containing just the difference in %H%M%S.
The desired result, algorithmically speaking, would be something like:
(time planned) - (time it actually took) = (difference format 00:18:12)