我有以下数据框:
+--------+----------+----------------------------+---------------------+---------------------+----------+ | Device | Category | Event | Start Time | End Time | Duration | +--------+----------+----------------------------+---------------------+---------------------+----------+ | WTG22 | State | Windturbine NO COMMUNICATE | 2019-06-26 12:23:46 | 2019-06-26 13:42:54 | 1:19:08 | | WTG22 | State | Windturbine PAUSE | 2019-06-26 12:23:46 | 2019-06-26 13:42:54 | 1:19:08 | | WTG22 | State | Windturbine NO COMMUNICATE | 2019-06-26 12:23:47 | 2019-06-26 13:42:54 | 1:19:07 | | WTG22 | State | Windturbine EMERGENCY | 2019-06-26 12:23:47 | 2019-06-26 12:24:09 | 0:00:22 | | WTG22 | State | Windturbine EMERGENCY | 2019-06-26 12:23:47 | 2019-06-26 12:24:11 | 0:00:24 | | WTG22 | State | Windturbine NO COMMUNICATE | 2019-06-26 12:24:11 | 2019-06-26 13:42:55 | 1:18:44 | +--------+----------+----------------------------+---------------------+---------------------+----------+
我需要工期列来说明重叠时间。如果一个事件的结束时间大于该事件之前的每个结束时间,则该事件应只有一个持续时间:
+----------+ | Duration | +----------+ | 1:19:08 | | 0:00:00 | | 0:00:00 | | 0:00:00 | | 0:00:00 | | 0:00:01 | +----------+