I have this dataframe
Poloniex_DOGE_BTC Poloniex_XMR_BTC Daily_rets perc_ret
172 0.006085 -0.000839 0.003309 0
173 0.006229 0.002111 0.005135 0
174 0.000000 -0.001651 0.004203 0
175 0.000000 0.007743 0.005313 0
176 0.000000 -0.001013 -0.003466 0
177 0.000000 -0.000550 0.000772 0
178 0.000000 -0.009864 0.001764 0
I'm trying to make a running total of daily_rets in perc_ret
however my code just copies the values from daily_rets
df['perc_ret'] = ( df['Daily_rets'] + df['perc_ret'].shift(1) )
Poloniex_DOGE_BTC Poloniex_XMR_BTC Daily_rets perc_ret
172 0.006085 -0.000839 0.003309 NaN
173 0.006229 0.002111 0.005135 0.005135
174 0.000000 -0.001651 0.004203 0.004203
175 0.000000 0.007743 0.005313 0.005313
176 0.000000 -0.001013 -0.003466 -0.003466
177 0.000000 -0.000550 0.000772 0.000772
178 0.000000 -0.009864 0.001764 0.001764