Put a description
Project description
Forecasting Basics
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
Built Distribution
Close
Hashes for time_series_model_basics-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d243d7f9f89cd10bc99a5506c4215f22becc642c9f16557dfc2c2d593a602b5 |
|
MD5 | c943d357330b722c228238e25256a9b2 |
|
BLAKE2b-256 | e6471c1aed3d13b27437a0082b4dc4ad0e4c8f407d0e1c0e2a6fcdc3b207ff14 |
Close
Hashes for time_series_model_basics-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06b67500fc42d20810a27a33c4bf1933f145932df99814ef2aa705ce943c640c |
|
MD5 | 27930d6fc532eadf9c12a464cee7837b |
|
BLAKE2b-256 | 15acb2694e88a99a4efbcb6f30a53b060bd6504d340cda7d3326ec75f12f1d61 |