I have a table like below and am looking to calculate the “Rollover” (Previous D value + B – C).
I am currently using: df[‘Rollover’] = (df[‘Rollover’].shift(1) + df[‘B’] – df[‘C’]) but after the second row, the value does not take the previous ‘Rollover’ value.