I have a dataframe that looks like this:
**time** **price**
1103 5
0010 10
0100 6
0201 8
0015 7
0400 4
0900 6
0800 3
1000 4
1140 5
1400 2
0030 1
0112 0
time = [1103,0010,0100,0201,0015,0400,0900,0800,1000,1140,1400,0030,0112]
price= [5,10,6,8,7,4,6,3,4,5,2,1,0]
Both the columns have dtype object.
I want to compare every time value to its previous and next value. If the value is greater than previous value and greater than next value (if the next value does not start with 00), I want the value to be replaced by previous value +100. So in our sample data the result will look like this:
**time** **price**
1103 5
0010 10
0100 6
0201 8
0015 7
0400 4
0500 (changed) 6
0800 3
1000 4
1140 5
1400 (not changed) 2
0030 1
0112 0
Would appreciate some help with that, thanks.