I have a pandas column "A" that reads like below.
A = A1, A2, A3, A4, A5, A6, A7
By using apply(), I need to create a new column "B" by using the below formula.
B1 = (A2 - A1)/A1
B2 = (A3 - A2)/A2
B3 = (A4 - A3)/A3
and so on. The problem is I need to refer to the previous cells of the same column to calculate the values for the new column.
Please help.