my input pandas dataframe would be the following:
timestamp value value_diff
0 1 100 NaN
1 2 110 10.0
2 3 112 2.0
3 4 130 18.0
4 5 8100 7970.0
5 6 8102 2.0
6 7 7998 -104.0
7 8 5000 -2998.0
8 9 140 -4860.0
9 10 180 40.0
10 11 200 20.0
11 12 205 5.0
12 13 230 25.0
13 14 8200 7970.0
14 15 3000 -5200.0
15 16 235 -2765.0
16 17 247 12.0
17 18 255 8.0
18 19 280 25.0
19 20 302 22.0
20 21 303 1.0
21 22 315 12.0
22 23 330 15.0
23 24 350 20.0
24 25 360 10.0
What I wanted to do is to remove all the data which it's difference is greater than 200 (in absolute value) and the data in between.
Therefore, the output would be something like this:
timestamp value value_diff
0 1 100 NaN
1 2 110 10.0
2 3 112 2.0
3 4 130 18.0
9 10 180 40.0
10 11 200 20.0
11 12 205 5.0
12 13 230 25.0
16 17 247 12.0
17 18 255 8.0
18 19 280 25.0
19 20 302 22.0
20 21 303 1.0
21 22 315 12.0
22 23 330 15.0
23 24 350 20.0
24 25 360 10.0
Thank you very much in advance!