rockfish.actions.replace
Attributes
Condition = Union[EqualizeCondition, TopKCondition, ThresholdCondition, SQLCondition]
module-attribute
Resample = Union[ValuesResample, SQLResample]
module-attribute
Classes
ReplaceConfig
Configuration class for the
Replace action.
Attributes:
| Name | Type | Description |
|---|---|---|
field |
str
|
Field name for replacement. |
condition |
Condition
|
The |
resample |
Optional[Resample]
|
The |
seed |
Optional[int]
|
Seed for random number generator. |
Replace
Replace values in a selected field with given condition with new values from the resampled result.
Attributes:
| Name | Type | Description |
|---|---|---|
Config |
TypeAlias
|
Alias for |
EqualizeCondition
EqualizeCondition class for the
condition
configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
equalization |
bool
|
If |
TopKCondition
TopKCondition class for the
condition
configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
top_k |
int
|
The number of top values to retain. The values not in the top_k will be replaced. |
ThresholdCondition
ThresholdCondition class for the
condition
configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
threshold |
float
|
The threshold value to retain. The values occupying less than the threshold will be replaced. |
SQLCondition
SQLCondition class for the
condition
configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
query |
str
|
A SQL query string that returns a 'mask' column. The values with True in the 'mask' column will be replaced. The input dataset is always referred to as |
ValuesResample
ValuesResample class for the
resample configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
replace_values |
list
|
A list of values to replace. The type of these values must match the field type. Each value is automatically assigned a weight of 1. |
SQLResample
SQLResample class for the
resample configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
query |
str
|
A SQL query string that returns 'values' and 'weights' columns. The 'values' column contains the values to replace, and the 'weights' column contains the weights for each value. The input dataset is always referred to as |