incline.deseasonalize

incline.deseasonalize(df, value_column='value', method='auto', period=None)[source]

Split a series into trend, cycle and remainder.

The front door for seasonality. Returns a frame, so the result can be handed to any estimator:

clean = deseasonalize(df)
result = sgolay_trend(
    clean, value_column="deseasonalized", with_uncertainty=True
)
Parameters:
  • df (DataFrame) – Time series data.

  • value_column (str) – Column holding the values.

  • method (str) – 'auto', 'stl' or 'simple'. 'auto' uses STL when a cycle is detected and leaves the series alone when none is.

  • period (int | None) – Cycle length. Detected when None.

Returns:

The frame plus DECOMPOSITION_COLUMNS, always the same columns whichever route ran.

Raises:

ValueError – If the method is unknown.

Return type:

DataFrame