snowflake.ml.modeling.preprocessing.LabelEncoder¶
- class snowflake.ml.modeling.preprocessing.LabelEncoder(input_cols: Optional[Union[str, Iterable[str]]] = None, output_cols: Optional[Union[str, Iterable[str]]] = None, drop_input_cols: Optional[bool] = False)¶
Bases:
BaseTransformer
Encodes target labels with values between 0 and n_classes-1.
In other words, each class (i.e., distinct numeric or string) is assigned an integer value, starting with zero. LabelEncoder is a specialization of OrdinalEncoder for 1-dimensional data.
For more details on what this transformer does, see sklearn.preprocessing.LabelEncoder.
- Args:
input_cols: The name of a column in a DataFrame to be encoded. May be a string or a list containing one string. output_cols: The name of a column in a DataFrame where the results will be stored. May be a string or a list
containing one string.
drop_input_cols: Remove input columns from output if set True. False by default.
Methods
fit
(dataset)Fit label encoder with label column in dataset.
transform
(dataset)Use fit result to transform snowpark dataframe or pandas dataframe.