cum_prod
cum_prod calculates a cumulative product in an update_by table operation.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| cols | list[str] | The column(s) to be operated on. These can include expressions to rename the output columns (e.g., |
Returns
An UpdateByOperation to be used in an update_by table operation.
Examples
The following example performs an update_by on the source table using the cum_prod operation. No grouping columns are given, so the cumulative product is calculated across all rows of the table.
The following example builds on the previous by specifying Letter as a grouping column. Thus, the cumulative product in the result table is calculated on a per-letter basis.
The following example builds on the previous by calculating the cumulative product of two columns using the same UpdateByOperation.
The following example builds on the previous by specifying two grouping columns: Letter and Truth. Thus, groups consist of unique combinations of letter in Letter and boolean in Truth.