Skip to content

featurebyte.UnexpectedValueImputation

class UnexpectedValueImputation(
*,
imputed_value: Union[bool, int, float, str, NoneType],
type: Literal["not_in"]="not_in",
expected_values: Sequence[Union[bool, int, float, str, NoneType]]
)

Description

UnexpectedValueImputation class is used to decalre the operation to impute the unexpected value of a table column. Note that this imputation operation will not impute missing value.

If the imputed_value parameter is None, the values to impute are replaced by missing values and the corresponding rows are ignored during aggregation operations.

Parameters

  • imputed_value: Union[bool, int, float, str, NoneType]
    The value that will be used to replace any value that does not match the expected values in the expected_values list.

  • type: Literal["not_in"]
    default: "not_in"

  • expected_values: Sequence[Union[bool, int, float, str, NoneType]]
    List of values that are expected to be present.

Examples

Create an imputation rule to replace value other than "buy" or "sell" to "missing"

>>> fb.UnexpectedValueImputation(
...     expected_values=["buy", "sell"], imputed_value="missing"
... )  # doctest: +SKIP