Operator

class nvtabular.ops.operator.Operator[source]

Bases: object

Base class for all operator classes.

dependencies()Optional[List[Union[str, ColumnGroup]]][source]

Defines an optional list of column dependencies for this operator. This lets you consume columns that aren’t part of the main transformation workflow.

Returns

Extra dependencies of this operator. Defaults to None

Return type

str, list of str or ColumnGroup, optional

inference_initialize(columns: List[Union[str, List[str]]], model_config: dict)Optional[nvtabular.ops.operator.Operator][source]

Configures this operator for use in inference. May return a different operator to use instead of the one configured for use during training

output_column_names(columns: List[Union[str, List[str]]])List[Union[str, List[str]]][source]

Given a set of columns names returns the names of the transformed columns this operator will produce

Parameters

columns (list of str, or list of list of str) – The columns to apply this operator to

Returns

The names of columns produced by this operator

Return type

list of str, or list of list of str

property supports

Returns what kind of data representation this operator supports

transform(columns: List[Union[str, List[str]]], df: pandas.core.frame.DataFrame)pandas.core.frame.DataFrame[source]

Transform the dataframe by applying this operator to the set of input columns

Parameters
  • columns (list of str or list of list of str) – The columns to apply this operator to

  • df (Dataframe) – A pandas or cudf dataframe that this operator will work on

Returns

Returns a transformed dataframe for this operator

Return type

DataFrame