Skip to content

featurebyte.TableCleaningOperation

class TableCleaningOperation(
*,
table_name: str,
column_cleaning_operations: List[ColumnCleaningOperation]
)

Description

The TableCleaningOperation object serves as a link between a table and cleaning configurations for the columns in the table. It is utilized when creating a new version of a feature that requires different cleaning configurations. The table_cleaning_operations parameter takes a list of these configurations. For each configuration, the ColumnCleaningOperation object establishes the relationship between the table and the corresponding cleaning operations for the table.

Parameters

  • table_name: str
    Name of the table that requires cleaning. The cleaning operations specified in the second parameter will be applied to this table.

  • column_cleaning_operations: List[ColumnCleaningOperation]
    List of cleaning operations that need to be performed on the columns of the table. The relationship between each column and its respective cleaning operations is established using the ColumnCleaningOperation constructor. This constructor takes two inputs: the name of the column and the cleaning operations that should be applied to that column.

Examples

Check table cleaning operation of this feature first:

>>> feature = catalog.get_feature("InvoiceAmountAvg_60days")
>>> feature.info()["table_cleaning_operation"]
{'this': [], 'default': []}

Create a new version of a feature with different table cleaning operations:

>>> new_feature = feature.create_new_version(
...     table_cleaning_operations=[
...         fb.TableCleaningOperation(
...             table_name="GROCERYINVOICE",
...             column_cleaning_operations=[
...                 fb.ColumnCleaningOperation(
...                     column_name="Amount",
...                     cleaning_operations=[fb.MissingValueImputation(imputed_value=0.0)],
...                 )
...             ],
...         )
...     ]
... )