ems_time
ems_time creates a time-based EMS (exponential moving sum) for an update_by table operation. The formula for the time-based EMS of a column is:
Where:
- is the difference between time and in nanoseconds.
- is
decay_timein nanoseconds, an input parameter to the method. - is the exponential moving sum of at time step .
- is the current value.
- denotes the time step, ranging from to , where is the number of elements in .
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| ts_col | str | The name of the column in the source table containing timestamps. |
| decay_time | Union[int, str] | The decay rate. This can be expressed as an integer in nanoseconds or a string duration, e.g., |
| cols | Union[str, list[str]] | The string names of columns to be operated on. These can include expressions to rename the output, e.g., |
| op_control | OperationControl | Defines how special cases should behave. When |
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 two ems_time operations.