suppose I have the following dataframe:
import pandas as pd
df = pd.DataFrame({'return':[10, 28, 32, 50, 25]})
I want to set 25 (last element) to be 100 in a new column and then work backwards doing 50*100/25=200, 32*100/25=32*200/50=128..and so on
return index
0 25
1 28
2 32 128
3 50 200
4 25 100
Is there any way of doing this in -preferably- one line. Thanks!
df['index']=.... ???
df['index'] = df['return'] * 4?