rolling_sum_time
rolling_sum_time creates a time-based windowed sum operator to be used in an update_by table operation. Data is windowed by reverse and forward time intervals relative to the current row, and the sum of the window is calculated.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| ts_col | str | The name of the column containing timestamps. |
| cols | list[str] | The column(s) to be operated on. These can include expressions to rename the output (e.g., |
| rev_time | Union[int,str] | The look-behind window size. This can be expressed as an integer in nanoseconds or a string duration, e.g., |
| fwd_time | Union[int,str] | The look-forward window size. This can be expressed as an integer in nanoseconds or a string duration, 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 three rolling_sum_time operations. Each operation gives varying rev_time and fwd_time values to show how they affect the output. The windows for each operation are as follows:
op_before: The window starts five seconds before the current row, and ends one second before the current row.op_after: The window starts one second after the current row, and ends five seconds after of the current row.op_middle: The window starts three seconds before the current row, and ends three seconds after the current row.