bigframes.pandas.api.typing.DataFrameGroupBy.cumprod#

DataFrameGroupBy.cumprod(*args, **kwargs) DataFrame[source]#

Cumulative product for each group.

Examples:

For SeriesGroupBy:

>>> lst = ['a', 'a', 'b']
>>> ser = bpd.Series([6, 2, 0], index=lst)
>>> ser.groupby(level=0).cumprod()
a     6.0
a    12.0
b     0.0
dtype: Float64

For DataFrameGroupBy:

>>> data = [[1, 8, 2], [1, 2, 5], [2, 6, 9]]
>>> df = bpd.DataFrame(data, columns=["a", "b", "c"],
...                   index=["cow", "horse", "bull"])
>>> df.groupby("a").cumprod()
          b     c
cow     8.0   2.0
horse  16.0  10.0
bull    6.0   9.0

[3 rows x 2 columns]
Returns:

Cumulative product for each group.

Return type:

bigframes.pandas.DataFrame or bigframes.pandas.Series