_OneSegmentTimeSeriesImputerTransform¶
- class _OneSegmentTimeSeriesImputerTransform(in_column: str, strategy: str, window: int, seasonality: int, default_value: Optional[float])[source]¶
Bases:
etna.transforms.base.Transform
One segment version of transform to fill NaNs in series of a given dataframe.
It is assumed that given series begins with first non NaN value.
This transform can’t fill NaNs in the future, only on train data.
This transform can’t fill NaNs if all values are NaNs. In this case exception is raised.
Create instance of _OneSegmentTimeSeriesImputerTransform.
- Parameters
in_column (str) – name of processed column
strategy (str) –
filling value in missing timestamps:
If “zero”, then replace missing dates with zeros
If “mean”, then replace missing dates using the mean in fit stage.
If “running_mean” then replace missing dates using mean of subset of data
If “forward_fill” then replace missing dates using last existing value
If “seasonal” then replace missing dates using seasonal moving average
window (int) –
In case of moving average and seasonality.
If
window=-1
all previous dates are taken in accountOtherwise only window previous dates
seasonality (int) – the length of the seasonality
default_value (Optional[float]) – value which will be used to impute the NaNs left after applying the imputer with the chosen strategy
- Raises
ValueError: – if incorrect strategy given
- Inherited-members
Methods
fit
(df)Fit preprocess params.
fit_transform
(df)May be reimplemented.
Inverse transform dataframe.
transform
(df)Transform given series.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.missing_values.imputation._OneSegmentTimeSeriesImputerTransform [source]¶
Fit preprocess params.
- Parameters
df (pd.DataFrame) – dataframe with series to fit preprocess params with
- Returns
self – fitted preprocess
- Return type