I need to calculate every other column (B columns). It needs to multiply the previous column (A) with column Col2, so Col2 * A1=B1 and then Col2 * A2=B2 and then Col2 * A3=B3

Col1 | Col2 | Col3 | A1 | B1 | A2 | B2 | A3 | C3 |
---|---|---|---|---|---|---|---|---|

2 | 5 | 10 | 8 | 9 | ||||

5 | 2 | 10 | 2 | 4 | ||||

9 | 3 | 27 | 8 | 3 |

for i in range(df.shape[1], 4, -1):

(df[‘Col2)’]*df[i]-1).round(decimals=1)

This is not working for me. Is there another way to loop through?