I have a dataframe like this:
df = pd.DataFrame({'Start':['2022-06-07 06:24:48','2022-06-07 14:37:16','2022-06-07 08:00:59', '2022-06-07 17:06:55','2022-06-07 06:02:41', '2022-06-07 13:03:17', '2022-06-07 05:02:01'],
'End':['2022-06-07 14:07:00','2022-06-07 21:51:21','2022-06-07 13:18:34','2022-06-07 22:14:35','2022-06-07 10:56:35', '2022-06-07 17:20:08', '2022-06-07 23:32:42'],
'Process':['PROD','PROD','VORG','VORG','NCPNA','NCPNA','STO'],
'Value':['','','FAUF1','FAUF2','PROG1','PROG2','ERR1'],
'Duration Min':[462,434,318,308,294,257,1110]})
I would like to create events that are dependent on the "Process=PROD" events and are based on its start and end timestamps. Depending on whether these timestamps are before, between or after the "Process=PROD" events.
So that I get the following output:
Start End Process Value Duration Min Marker
0 2022-06-07 06:24:48 2022-06-07 14:07:00 PROD 462 Orginal
1 2022-06-07 14:37:16 2022-06-07 21:51:21 PROD 434 Orginal
2 2022-06-07 08:00:59 2022-06-07 13:18:34 VORG FAUF1 318 Orginal
3 2022-06-07 17:06:55 2022-06-07 22:14:35 VORG FAUF2 308 Orginal
4 2022-06-07 06:02:41 2022-06-07 10:56:35 NCPNA PROG1 294 Orginal
5 2022-06-07 13:03:17 2022-06-07 17:20:08 NCPNA PROG2 257 Orginal
6 2022-06-07 05:02:01 2022-06-07 23:32:42 STO ERR1 1110 Orginal
7 2022-06-07 08:00:59 2022-06-07 13:18:34 VORG FAUF1 318 PROD
8 2022-06-07 17:06:55 2022-06-07 21:51:21 VORG FAUF2 284 PROD
9 2022-06-07 06:24:48 2022-06-07 10:56:35 NCPNA PROG1 271 PROD
10 2022-06-07 13:03:17 2022-06-07 14:07:00 NCPNA PROG1 63 PROD
11 2022-06-07 14:37:16 2022-06-07 17:20:08 NCPNA PROG2 162 PROD
12 2022-06-07 06:24:48 2022-06-07 14:07:00 STO ERR1 462 PROD
13 2022-06-07 14:37:16 2022-06-07 21:51:21 STO ERR1 434 PROD
here is a picture of what i actually mean:
