I am having a tough time with this one - not sure why...maybe it\'s the late hour.
I have a dataframe in pandas as follows:
1 10
2 11
3 20
4
Note, since your example is just a single column, a cumulative product can be done succinctly with a Series
:
import pandas as pd
s = pd.Series([10, 11, 20, 5, 10])
s
# Output
0 10
1 11
2 20
3 5
4 10
dtype: int64
s.cumprod()
# Output
0 10
1 110
2 2200
3 11000
4 110000
dtype: int64
Kudos to @bananafish for locating the inherent cumprod
method.