LabelEncoderTransform¶
- class LabelEncoderTransform(in_column: str, out_column: Optional[str] = None, strategy: str = ImputerMode.mean)[source]¶
Bases:
etna.transforms.base.Transform
Encode categorical feature with value between 0 and n_classes-1.
Init LabelEncoderTransform.
- Parameters
in_column (str) – Name of column to be transformed
out_column (Optional[str]) – Name of added column. If not given, use
self.__repr__()
strategy (str) –
Filling encoding in not fitted values:
If “new_value”, then replace missing values with ‘-1’
If “mean”, then replace missing values using the mean in encoded column
If “none”, then replace missing values with None
- Inherited-members
Methods
fit
(df)Fit Label encoder.
fit_transform
(df)May be reimplemented.
inverse_transform
(df)Inverse transforms dataframe.
transform
(df)Encode the
in_column
by fitted Label encoder.- fit(df: pandas.core.frame.DataFrame) etna.transforms.encoders.categorical.LabelEncoderTransform [source]¶
Fit Label encoder.
- Parameters
df (pandas.core.frame.DataFrame) – Dataframe with data to fit the transform
- Returns
Fitted transform
- Return type