So i have this code:
monthly['differences'] = monthly.GMV.diff()
monthly['percentage'] = monthly.differences / (monthly.GMV - monthly.differences) *100
monthly
which produce this dataframe:
GMV differences percentage
date
1 69793.30 NaN NaN
2 65159.60 -4633.70 -6.639176
3 70397.10 5237.50 8.037956
4 68736.80 -1660.30 -2.358478
5 71402.75 2665.95 3.878490
6 68230.20 -3172.55 -4.443176
7 72557.90 4327.70 6.342792
8 68278.25 -4279.65 -5.898255
9 64180.05 -4098.20 -6.002204
10 64027.60 -152.45 -0.237535
11 70395.35 6367.75 9.945320
12 64701.15 -5694.20 -8.088887
And i want to add new rows from the existing data with loop, i wanted the 13th row to have these value:
GMV13 = GMV12 + (GMV12 * percent12)
diff13= GMV13 - GMV12
percent13= diff13 / (GMV13 * diff13) * 100
And for the 14th row and on as well until the data will kinda look like this: (ignore the value, this is just an example)
GMV differences percentage
date
1 69793.30 NaN NaN
2 65159.60 -4633.70 -6.639176
3 70397.10 5237.50 8.037956
4 68736.80 -1660.30 -2.358478
5 71402.75 2665.95 3.878490
6 68230.20 -3172.55 -4.443176
7 72557.90 4327.70 6.342792
8 68278.25 -4279.65 -5.898255
9 64180.05 -4098.20 -6.002204
10 64027.60 -152.45 -0.237535
11 70395.35 6367.75 9.945320
12 64701.15 -5694.20 -8.088887
13 70397.10 5237.50 8.037956
14 68736.80 -1660.30 -2.358478
15 71402.75 2665.95 3.878490
16 68230.20 -3172.55 -4.443176
17 72557.90 4327.70 6.342792
18 68278.25 -4279.65 -5.898255
19 64180.05 -4098.20 -6.002204
percent13doesn't make much sense to me... What's the idea behind it?percent13 = percent12