The df looks like below:
Time A
2019-05-18 01:15:28 7
2019-05-18 01:28:11 7
2019-05-18 01:36:36 12
2019-05-18 01:39:47 12
2019-05-18 01:53:32 12
2019-05-18 02:05:37 7
I understand how to calculate consecutive row time difference. But I want to calculate the time difference whenever the Value in A is 7 to 12.
Expected output:
Time A Time_difference
2019-05-18 01:15:28 7 0
2019-05-18 01:28:11 7 0
2019-05-18 01:36:36 12 00:21:08
2019-05-18 01:39:47 12 0
2019-05-18 01:53:32 12 0
2019-05-18 02:05:37 12 0
timedeltaobject for time calculations.7and12?7and12values for minimal, complete, and verifiable example? I think also if more consecutive7or12or both.