I'm trying to access mutiple columns in rolling time window
My dataset is like
index Time B C
0 00:00 90 70
1 00:01 90 10
2 00:02 20 10
3 00:03 90 20
Suppose a 3 second window, my target is to get the time difference between current row and the nearest row with same B value,
also with current row C value larger than 20. So, it needs to access all columns to perform comparsion and filtering
An example of expected output is like
index Time B C Time difference
0 00:00 90 70
1 00:01 90 10
2 00:02 20 10 00:00
3 00:03 90 20 00:02
Window from index 1-3 with window size 3, row 3 and row 1 will be qualified
I tried this question, which works for numeric window size, but not for time window.
How can I access all columns in a time window, or to achieve the same result ?
Thank you!