_SingleDifferencingTransform

class _SingleDifferencingTransform(in_column: str, period: int = 1, inplace: bool = True, out_column: Optional[str] = None)[source]

Bases: etna.transforms.base.ReversibleTransform

Calculate a time series differences of order 1.

During fit this transform can work with NaNs at the beginning of the segment, but fails when meets NaN inside the segment. During transform and inverse_transform there is no special treatment of NaNs.

Notes

To understand how transform works we recommend: Stationarity and Differencing

Create instance of _SingleDifferencingTransform.

Parameters
  • in_column (str) – name of processed column

  • period (int) – number of steps back to calculate the difference with, it should be >= 1

  • inplace (bool) –

    • if True, apply transformation inplace to in_column,

    • if False, add transformed column to dataset

  • out_column (Optional[str]) –

    • if set, name of added column, the final name will be ‘{out_column}’;

    • if isn’t set, name will be based on self.__repr__()

Raises

ValueError: – if period is not integer >= 1

Inherited-members

Methods

fit(ts)

Fit the transform.

fit_transform(ts)

Fit and transform TSDataset.

get_regressors_info()

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.differencing._SingleDifferencingTransform[source]

Fit the transform.

Parameters

ts (etna.datasets.tsdataset.TSDataset) –

Return type

etna.transforms.math.differencing._SingleDifferencingTransform

get_regressors_info() List[str][source]

Return the list with regressors created by the transform.

Return type

List[str]