OneHotEncoderTransform¶
- class OneHotEncoderTransform(in_column: str, out_column: Optional[str] = None)[source]¶
Bases:
etna.transforms.base.Transform
Encode categorical feature as a one-hot numeric features.
If unknown category is encountered during transform, the resulting one-hot encoded columns for this feature will be all zeros.
Init OneHotEncoderTransform.
- Parameters
in_column (str) – Name of column to be encoded
out_column (Optional[str]) – Prefix of names of added columns. If not given, use
self.__repr__()
- Inherited-members
Methods
fit
(df)Fit One Hot encoder.
fit_transform
(df)May be reimplemented.
inverse_transform
(df)Inverse transforms dataframe.
transform
(df)Encode the in_column by fitted One Hot encoder.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.encoders.categorical.OneHotEncoderTransform [source]¶
Fit One Hot encoder.
- Parameters
df (pandas.core.frame.DataFrame) – Dataframe with data to fit the transform
- Returns
Fitted transform
- Return type