i am trying to get a balance column in a python dataframe with an initial static value.
The logic:
start balance = 1000
current balance = previous current balance*(1+df['return'])
My attempt:
df.at[1,'current balance'] = 1000
df['current balance'] = df['current balance'].shift(1)*(1+df['return])
I can't get this output
Output dataframe:
return current balance
0.01 1010.00
0.03 1040.30
0.045 1087.11