Skip to main content

A Python implementation of seasonal trend with Loess (STL) time series decomposition

Project description

This is a relatively naive Python implementation of a seasonal and trend decomposition using Loess smoothing. Commonly referred to as an “STL decomposition”, Cleveland’s 1990 paper is the canonical reference.

This implementation is a variation of (and takes inspiration from) the implementation of the seasonal_decompose method in statsmodels. In this implementation, the trend component is calculated by substituting a configurable Loess regression for the convolutional method used in seasonal_decompose. It also extends the existing DecomposeResult from statsmodels to allow for forecasting based on the calculated decomposition.


The stldecompose package is relatively lightweight. It uses pandas.Dataframe for inputs and outputs, and exposes only a couple of primary methods - decompose() and forecast() - as well as a handful of built-in forecasting functions.

See the included IPython notebook for more details and usage examples.


A Python 3 virtual environment is recommended.

The preferred method of installation is via pip:

(env) $ pip install stldecompose

If you’d like the bleeding-edge version, you can also install from this Github repo:

(env) $ git clone
(env) $ cd STLDecompose; pip install .

More Resources

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stldecompose, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size stldecompose-0.0.5-py2.py3-none-any.whl (6.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size stldecompose-0.0.5.tar.gz (7.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page