LambdaTransform¶
- class LambdaTransform(in_column: str, transform_func: Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame], inplace: bool = True, out_column: Optional[str] = None, inverse_transform_func: Optional[Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame]] = None)[source]¶
Bases:
etna.transforms.base.ReversibleTransform
LambdaTransform
applies input function for given series.Init
LambdaTransform
.- Parameters
in_column (str) – column to apply transform
out_column (Optional[str]) – name of added column. If not given, use
self.__repr__()
transform_func (Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame]) – function to transform data
inverse_transform_func (Optional[Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame]]) – inverse function of
transform_func
inplace (bool) –
if True, apply transformation inplace to
in_column
,if False, add column and apply transformation to
out_column
Warning
throws if inplace=True and
out_column
is initialized, transformation will be applied inplace- Raises
Value error: – if inplace=True and
inverse_transform_func
is not defined- Inherited-members
- Parameters
in_column (str) –
transform_func (Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame]) –
inplace (bool) –
out_column (Optional[str]) –
inverse_transform_func (Optional[Callable[[pandas.core.frame.DataFrame], pandas.core.frame.DataFrame]]) –
Methods
fit
(ts)Fit the transform.
fit_transform
(ts)Fit and transform TSDataset.
Return the list with regressors created by the transform.
inverse_transform
(ts)Inverse transform TSDataset.
load
(path)Load an object.
params_to_tune
()Get grid for tuning hyperparameters.
save
(path)Save the object.
set_params
(**params)Return new object instance with modified parameters.
to_dict
()Collect all information about etna object in dict.
transform
(ts)Transform TSDataset inplace.
- fit(ts: etna.datasets.tsdataset.TSDataset) etna.transforms.math.apply_lambda.LambdaTransform [source]¶
Fit the transform.
- Parameters
- Return type