I have the following two time columns: "Time1" and "Time2". I need to compute the column "Difference", which is (Time2-Time1) in Pandas:
Time1 Time2 Difference
8:59:45 9:27:30 -1 days +23:27:45
9:52:29 10:08:54 -1 days +23:16:26
8:07:15 8:07:53 00:00:38
When Time1 and Time2 are at different hours, I get the result as "-1 days +". My desired result for the first two values ββis given below:
Time1 Time2 Difference
8:59:45 9:27:30 00:27:45
9:52:29 10:08:54 00:16:26
How can I get this output in Pandas?
Both times are in the 'datetime64 [ns]' dtype.
source
share