Skip to main content

Put a description

Project description

Forecasting Basics

Documentation and Code is hosted on Github

Generate and Plot Forecasts for Time Series Data

Includes:SMA, WMA and Single and Double Exponential Smoothing

Install

pip install time-series-model-basics

Simple Moving Average

Plot a Simulated Time Series with two or any number of Simple Moving Averages as follows:

from time_series_model_basics.moving_average import SMA

df, fig = SMA(1, 4)

fig.write_image("images/sma.png")

When running on a notebook you may alternatively use

fig.show()

Forecast with dataframe as follows:

import pandas as pd

df = pd.read_csv(
    '../data/Electric_Production.csv',
    index_col='DATE',
    parse_dates=['DATE'],
)
ts_col = 'Electric Production'
df.columns = [ts_col]
_, fig = SMA(
    4,
    df=df,
    ts_col=ts_col,
)
fig.update_layout(
    autosize=False,
    width=1100,
    height=450,
)
fig.update_traces(line=dict(width=0.8))
fig.write_image("images/elec_prod_sma.png",)

Weighted Moving Average

For the case of Weighted Moving Averages, pass the weights as lists:

from time_series_model_basics.moving_average import WMA

df,fig = WMA([1,1,2],[3,2])

fig.write_image("images/wma.png")

Simple Smoothing

Plot a Simulated Time Series with two or any number of simple exponential smoothing as follows:

from time_series_model_basics.smoothing import SINGLE

df, fig = SINGLE(.15, .5)
fig.write_image("images/single.png",)

Double Smoothing

from time_series_model_basics.smoothing import DOUBLE

df, fig = DOUBLE(
    [.25, .3],
    [.5, .6],
)
fig.write_image("images/double.png")

Author

  • Enrique Jimenez

Project details


Download files

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

Source Distribution

time_series_model_basics-0.0.5.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

time_series_model_basics-0.0.5-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file time_series_model_basics-0.0.5.tar.gz.

File metadata

  • Download URL: time_series_model_basics-0.0.5.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.6

File hashes

Hashes for time_series_model_basics-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1d243d7f9f89cd10bc99a5506c4215f22becc642c9f16557dfc2c2d593a602b5
MD5 c943d357330b722c228238e25256a9b2
BLAKE2b-256 e6471c1aed3d13b27437a0082b4dc4ad0e4c8f407d0e1c0e2a6fcdc3b207ff14

See more details on using hashes here.

File details

Details for the file time_series_model_basics-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: time_series_model_basics-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.6

File hashes

Hashes for time_series_model_basics-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 06b67500fc42d20810a27a33c4bf1933f145932df99814ef2aa705ce943c640c
MD5 27930d6fc532eadf9c12a464cee7837b
BLAKE2b-256 15acb2694e88a99a4efbcb6f30a53b060bd6504d340cda7d3326ec75f12f1d61

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page