deephaven.updateby#
This module supports building various operations for use with the update-by Table operation.
- class BadDataBehavior(value)[source]#
Bases:
Enum
An Enum defining ways to handle invalid data during update-by operations.
- POISON = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x55d5b09f62aa)#
Allow the bad data to poison the result. This is only valid for use with NaN
- RESET = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x55d5b09f629a)#
Reset the state for the bucket to None when invalid data is encountered
- SKIP = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x55d5b09f62a2)#
Skip and do not process the invalid data without changing state
- THROW = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x55d5b09f6292)#
Throw an exception and abort processing when bad data is encountered
- class DeltaControl(value)[source]#
Bases:
Enum
An Enum defining ways to handle null values during update-by Delta operations where delta operations return the difference between the current row and the previous row.
- NULL_DOMINATES = io.deephaven.api.updateby.DeltaControl(objectRef=0x55d5b09f62e2)#
A valid value following a null value returns null
- VALUE_DOMINATES = io.deephaven.api.updateby.DeltaControl(objectRef=0x55d5b09f62ea)#
A valid value following a null value returns the valid value
- ZERO_DOMINATES = io.deephaven.api.updateby.DeltaControl(objectRef=0x55d5b09f62f2)#
A valid value following a null value returns zero
- class MathContext(value)[source]#
Bases:
Enum
An Enum for predefined precision and rounding settings in numeric calculation.
- DECIMAL128 = java.math.MathContext(objectRef=0x55d5b09f631a)#
a precision setting matching the IEEE 754R Decimal128 format, 34 digits, rounding is half-even
- DECIMAL32 = java.math.MathContext(objectRef=0x55d5b09f630a)#
a precision setting matching the IEEE 754R Decimal32 format, 7 digits, rounding is half-even
- DECIMAL64 = java.math.MathContext(objectRef=0x55d5b09f6312)#
a precision setting matching the IEEE 754R Decimal64 format, 16 digits, rounding is half-even
- UNLIMITED = java.math.MathContext(objectRef=0x55d5b09f6302)#
unlimited precision arithmetic, rounding is half-up
- class OperationControl(on_null=BadDataBehavior.SKIP, on_nan=BadDataBehavior.SKIP, big_value_context=MathContext.DECIMAL128)[source]#
Bases:
JObjectWrapper
A OperationControl represents control parameters for performing operations with the table UpdateByOperation.
Initializes an OperationControl for use with certain UpdateByOperation, such as EMAs.
- Parameters:
on_null (BadDataBehavior) – the behavior for when null values are encountered, default is SKIP
on_nan (BadDataBehavior) – the behavior for when NaN values are encountered, default is SKIP
big_value_context (MathContext) – the context to use when processing arbitrary precision numeric values (Java BigDecimal/BigInteger), default is DECIMAL128.
- Raises:
DHError –
- j_object_type#
alias of
OperationControl
- class UpdateByOperation(j_updateby_op)[source]#
Bases:
JObjectWrapper
A UpdateByOperation represents an operator for the Table update-by operation.
- j_object_type#
alias of
UpdateByOperation
- cum_max(cols)[source]#
Creates a cumulative maximum UpdateByOperation for the supplied column names.
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the cumulative maximum operation on all the applicable columns.
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- cum_min(cols)[source]#
Creates a cumulative minimum UpdateByOperation for the supplied column names.
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the cumulative minimum operation on all the applicable columns.
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- cum_prod(cols)[source]#
Creates a cumulative product UpdateByOperation for the supplied column names.
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performing the cumulative product operation on all the applicable columns.
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- cum_sum(cols)[source]#
Creates a cumulative sum UpdateByOperation for the supplied column names.
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the cumulative sum operation on all the applicable columns.
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- delta(cols, delta_control=DeltaControl.NULL_DOMINATES)[source]#
Creates a delta UpdateByOperation for the supplied column names. The Delta operation produces values by computing the difference between the current value and the previous value. When the current value is null, this operation will output null. When the current value is valid, the output will depend on the DeltaControl provided.
When delta_control is not provided or set to NULL_DOMINATES, a value following a null value returns null. When delta_control is set to VALUE_DOMINATES, a value following a null value returns the value. When delta_control is set to ZERO_DOMINATES, a value following a null value returns zero.
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the delta operation on all the applicable columns.
delta_control (DeltaControl) – defines how special cases should behave; when None, the default DeltaControl settings of VALUE_DOMINATES will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- ema_tick(decay_ticks, cols, op_control=None)[source]#
Creates an EMA (exponential moving average) UpdateByOperation for the supplied column names, using ticks as the decay unit.
The formula used is
a = e^(-1 / decay_ticks)ema_first = first_valueema_current = a * ema_prev + (1 - a) * current_value- Parameters:
decay_ticks (float) – the decay rate in ticks
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all applicable columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- ema_time(ts_col, decay_time, cols, op_control=None)[source]#
Creates an EMA(exponential moving average) UpdateByOperation for the supplied column names, using time as the decay unit.
The formula used is
dt_current = current_timestamp - prev_timestampa_current = e^(-dt_current / decay_time)ema_first = first_valueema_current = a_current * ema_prev + (1 - a_current) * current_value- Parameters:
ts_col (str) – the column in the source table to use for timestamps
decay_time (Union[int, str]) – the decay rate, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all applicable columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- emmax_tick(decay_ticks, cols, op_control=None)[source]#
Creates an EM Max (exponential moving maximum) UpdateByOperation for the supplied column names, using ticks as the decay unit.
The formula used is
a = e^(-1 / decay_ticks)emmax_first = first_valueemmax_current = max(a * emmax_prev, current_value)- Parameters:
decay_ticks (float) – the decay rate in ticks
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- emmax_time(ts_col, decay_time, cols, op_control=None)[source]#
Creates an EM Max (exponential moving maximum) UpdateByOperation for the supplied column names, using time as the decay unit.
The formula used is
dt_current = current_timestamp - prev_timestampa_current = e^(-dt_current / decay_time)emmax_first = first_valueemmax_current = max(a_current * emmax_prev, current_value)- Parameters:
ts_col (str) – the column in the source table to use for timestamps
decay_time (Union[int, str]) – the decay rate, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- emmin_tick(decay_ticks, cols, op_control=None)[source]#
Creates an EM Min (exponential moving minimum) UpdateByOperation for the supplied column names, using ticks as the decay unit.
The formula used is
a = e^(-1 / decay_ticks)emmin_first = first_valueemmin_current = min(a * emmin_prev, current_value)- Parameters:
decay_ticks (float) – the decay rate in ticks
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- emmin_time(ts_col, decay_time, cols, op_control=None)[source]#
Creates an EM Min (exponential moving minimum) UpdateByOperation for the supplied column names, using time as the decay unit.
The formula used is
dt_current = current_timestamp - prev_timestampa_current = e^(-dt_current / decay_time)emmin_first = first_valueemmin_current = min(a_current * emmin_last, value)- Parameters:
ts_col (str) – the column in the source table to use for timestamps
decay_time (Union[int, str]) – the decay rate, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- ems_tick(decay_ticks, cols, op_control=None)[source]#
Creates an EMS (exponential moving sum) UpdateByOperation for the supplied column names, using ticks as the decay unit.
The formula used is
a = e^(-1 / decay_ticks)ems_first = first_valueems_current = a * ems_prev + current_value- Parameters:
decay_ticks (float) – the decay rate in ticks
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all applicable columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- ems_time(ts_col, decay_time, cols, op_control=None)[source]#
Creates an EMS (exponential moving sum) UpdateByOperation for the supplied column names, using time as the decay unit.
The formula used is
dt_current = current_timestamp - prev_timestampa_current = e^(-dt_current / decay_time)ems_first = first_valueems_current = a_current * ems_prev + current_value- Parameters:
ts_col (str) – the column in the source table to use for timestamps
decay_time (Union[int, str]) – the decay rate, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by performs the operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- emstd_tick(decay_ticks, cols, op_control=None)[source]#
Creates an EM Std (exponential moving standard deviation) UpdateByOperation for the supplied column names, using ticks as the decay unit.
The formula used is
a = e^(-1 / decay_ticks)em_variance_current = a * (em_variance_prev + (1 − a) * (current_value − ema_prev)^2)emstd_current = sqrt(em_variance_current)- Parameters:
decay_ticks (float) – the decay rate in ticks
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the ems operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- emstd_time(ts_col, decay_time, cols, op_control=None)[source]#
Creates an EM Std (exponential moving standard deviation) UpdateByOperation for the supplied column names, using time as the decay unit.
The formula used is
dt_current = current_timestamp - prev_timestampa_current = e^(-dt_current / decay_time)em_variance_first = 0em_variance_current = a_current * (em_variance_prev + (1 − a_current) * (current_value − ema_prev)^2)emstd_current = sqrt(em_variance_current)- Parameters:
ts_col (str) – the column in the source table to use for timestamps
decay_time (Union[int, str]) – the decay rate, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the ems operation on all columns.
op_control (OperationControl) – defines how special cases should behave; when None, the default OperationControl settings as specified in
__init__()
will be used
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- forward_fill(cols)[source]#
Creates a forward fill UpdateByOperation for the supplied column names. Null values in the columns are replaced by the last known non-null values. This operation is forward only.
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the forward fill operation on all columns.
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_avg_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling average UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling average operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_avg_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling average UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling average operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_count_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling count UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling count operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_count_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling count UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling count operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_group_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling group UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling group operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_group_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling group UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling group operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_max_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling maximum UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling maximum operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_max_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling maximum UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling maximum operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_min_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling minimum UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling minimum operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_min_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling minimum UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling minimum operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_prod_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling product UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling product operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_prod_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling product UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling product operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_std_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling sample standard deviation UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
Sample standard deviation is computed using Bessel’s correction, which ensures that the sample variance will be an unbiased estimator of population variance.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling sample standard deviation operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_std_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling sample standard deviation UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
Sample standard deviation is computed using Bessel’s correction, which ensures that the sample variance will be an unbiased estimator of population variance.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling sample standard deviation operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_sum_tick(cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling sum UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling sum operation on all columns.
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_sum_time(ts_col, cols, rev_time, fwd_time=0)[source]#
Creates a rolling sum UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling sum operation on all columns.
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_wavg_tick(wcol, cols, rev_ticks, fwd_ticks=0)[source]#
Creates a rolling weighted average UpdateByOperation for the supplied column names, using ticks as the windowing unit. Ticks are row counts, and you may specify the reverse and forward window in number of rows to include. The current row is considered to belong to the reverse window but not the forward window. Also, negative values are allowed and can be used to generate completely forward or completely reverse windows.
- Here are some examples of window values:
- rev_ticks = 1, fwd_ticks = 0 - contains only the current rowrev_ticks = 10, fwd_ticks = 0 - contains 9 previous rows and the current rowrev_ticks = 0, fwd_ticks = 10 - contains the following 10 rows, excludes the current rowrev_ticks = 10, fwd_ticks = 10 - contains the previous 9 rows, the current row and the 10 rows followingrev_ticks = 10, fwd_ticks = -5 - contains 5 rows, beginning at 9 rows before, ending at 5 rows before the current row (inclusive)rev_ticks = 11, fwd_ticks = -1 - contains 10 rows, beginning at 10 rows before, ending at 1 row before the current row (inclusive)rev_ticks = -5, fwd_ticks = 10 - contains 5 rows, beginning 5 rows following, ending at 10 rows following the current row (inclusive)
- Parameters:
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling weighted average operation on all columns.
cols – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling weighted average operation on all columns.
wcol (str) – the column containing the weight values
rev_ticks (int) – the look-behind window size (in rows/ticks)
fwd_ticks (int) – the look-forward window size (int rows/ticks), default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –
- rolling_wavg_time(ts_col, wcol, cols, rev_time, fwd_time=0)[source]#
Creates a rolling weighted average UpdateByOperation for the supplied column names, using time as the windowing unit. This function accepts nanoseconds or time strings as the reverse and forward window parameters. Negative values are allowed and can be used to generate completely forward or completely reverse windows. A row containing a null in the timestamp column belongs to no window and will not be considered in the windows of other rows; its output will be null.
- Here are some examples of window values:
- rev_time = 0, fwd_time = 0 - contains rows that exactly match the current row timestamprev_time = “PT00:10:00”, fwd_time = “0” - contains rows from 10m before through the current row timestamp ( inclusive)rev_time = 0, fwd_time = 600_000_000_000 - contains rows from the current row through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “PT00:10:00” - contains rows from 10m before through 10m following the current row timestamp (inclusive)rev_time = “PT00:10:00”, fwd_time = “-PT00:05:00” - contains rows from 10m before through 5m before the current row timestamp (inclusive), this is a purely backwards looking windowrev_time = “-PT00:05:00”, fwd_time = “PT00:10:00” - contains rows from 5m following through 10m following the current row timestamp (inclusive), this is a purely forwards looking window
- Parameters:
ts_col (str) – the timestamp column for determining the window
cols (Union[str, List[str]]) – the column(s) to be operated on, can include expressions to rename the output, i.e. “new_col = col”; when empty, update_by perform the rolling weighted average operation on all columns.
wcol (str) – the column containing the weight values
rev_time (int) – the look-behind window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”
fwd_time (int) – the look-ahead window size, can be expressed as an integer in nanoseconds or a time interval string, e.g. “PT00:00:00.001” or “PT5M”, default is 0
- Return type:
- Returns:
an UpdateByOperation
- Raises:
DHError –