Rename
-
class
nvtabular.ops.
Rename
(f=None, postfix=None, name=None)[source] Bases:
nvtabular.ops.operator.Operator
This operation renames columns by one of several methods:
using a user defined lambda function to transform column names
appending a postfix string to every column name
renaming a single column to a single fixed string
Example usage:
# Rename columns after LogOp cont_features = cont_names >> nvt.ops.LogOp() >> Rename(postfix='_log') processor = nvt.Workflow(cont_features)
- Parameters
-
transform
(col_selector: nvtabular.columns.selector.ColumnSelector, 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
-
compute_output_schema
(input_schema: nvtabular.columns.schema.Schema, col_selector: nvtabular.columns.selector.ColumnSelector) → nvtabular.columns.schema.Schema[source]