Examples
Series

In [1]:
import numpy as np
import pandas as pd
In [2]:
s = pd.Series([2, np.nan, 4, -3, 0])
s
Out[2]:
0    2.0
1    NaN
2    4.0
3   -3.0
4    0.0
dtype: float64

By default, NA values are ignored.

In [3]:
s.cumprod()
Out[3]:
0     2.0
1     NaN
2     8.0
3   -24.0
4    -0.0
dtype: float64

To include NA values in the operation, use skipna=False

In [4]:
s.cumprod(skipna=False)
Out[4]:
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64

By default, iterates over rows and finds the product in each column. This is equivalent
to axis=None or axis='index'.