I have a dataset as follows:-
RATE PriceDifference
84 0
84 0
85 0
85 0
85 0
84 0
83.1 0
I want to replace all the values of 2nd column with the difference between this row's RATE
and the previous row's RATE
.
An example: The second row should have the value (84 - 84 =) 0 in PriceDifference
. Similarly, the last row should have a value of -0.9 because 83.1 - 84 = 0.9