deephaven.updateby¶
This module supports building various operations for use with the update-by Table operation.
- class BadDataBehavior(value)[source]¶
Bases:
enum.Enum
An Enum defining ways to handle invalid data during update-by operations.
- POISON = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x3cfd788)¶
Allow the bad data to poison the result. This is only valid for use with NaN
- RESET = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x3cfd778)¶
Reset the state for the bucket to None when invalid data is encountered
- SKIP = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x3cfd780)¶
Skip and do not process the invalid data without changing state
- THROW = io.deephaven.api.updateby.BadDataBehavior(objectRef=0x3cfd770)¶
Throw an exception and abort processing when bad data is encountered
- class MathContext(value)[source]¶
Bases:
enum.Enum
An Enum for predefined precision and rounding settings in numeric calculation.
- DECIMAL128 = java.math.MathContext(objectRef=0x3cfd7c8)¶
a precision setting matching the IEEE 754R Decimal128 format, 34 digits, rounding is half-even
- DECIMAL32 = java.math.MathContext(objectRef=0x3cfd7b8)¶
a precision setting matching the IEEE 754R Decimal32 format, 7 digits, rounding is half-even
- DECIMAL64 = java.math.MathContext(objectRef=0x3cfd7c0)¶
a precision setting matching the IEEE 754R Decimal64 format, 16 digits, rounding is half-even
- UNLIMITED = java.math.MathContext(objectRef=0x3cfd7b0)¶
unlimited precision arithmetic, rounding is half-up
- class OperationControl(on_null=BadDataBehavior.SKIP, on_nan=BadDataBehavior.SKIP, on_null_time=BadDataBehavior.SKIP, on_negative_deltatime=BadDataBehavior.THROW, on_zero_deltatime=BadDataBehavior.SKIP, big_value_context=MathContext.DECIMAL128)[source]¶
Bases:
deephaven._wrapper.JObjectWrapper
A OperationControl represents control parameters for performing operations with the table UpdateByOperation.
- j_object_type¶
alias of
io.deephaven.api.updateby.OperationControl
- class UpdateByOperation(j_updateby_op)[source]¶
Bases:
deephaven._wrapper.JObjectWrapper
A UpdateByOperation represents an operator for the Table update-by operation.
- j_object_type¶
alias of
io.deephaven.api.updateby.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 –
- ema_tick_decay(time_scale_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 / time_scale_ticks) ema_next = a * ema_last + (1 - a) * value
- Parameters
time_scale_ticks (int) – the decay rate in ticks
cols (Union[str, List[str]]) – the column(s) to be operated on, can be renaming expressions, i.e. “new_col = col”
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_decay(ts_col, time_scale, 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
a = e^(-dt / time_scale_nanos) ema_next = a * ema_last + (1 - a) * value
- Args:
ts_col (str): the column in the source table to use for timestamps
- time_scale (Union[int, str]): the decay rate, can be expressed as an integer in nanoseconds or a time
interval string, e.g. “00:00:00.001”
cols (Union[str, List[str]]): the column(s) to be operated on, can be renaming expressions, i.e. “new_col = col” 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 –