I am trying to convert VBA macro to python script. I need to add a new column to dataframe:
X Y
1 2
3 4
5 6
7 8
that will be a sum of a value above (0 for the first one) and value from X multiplied by Y summed with a value above :
X Y Z Z(calculations)
1 2 0 0
3 4 12 0 + 3*(4+0)
5 6 102 12 + 5*(6+12)
7 8 872 102 + 7*(8+102)
So basically Excel formula (in Z2 Cell):
=Z1+X2*(Y2+Z1)
Is there an easy (and quick) way to do this?