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
Metadata
Release files for time-series-model-basics 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| time_series_model_basics-0.0.5.tar.gz | 15.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| time_series_model_basics-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.9 kB
Release files / time_series_model_basics-0.0.5.tar.gz
| Download URL | time_series_model_basics-0.0.5.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d243d7f9f89cd10bc99a5506c4215f22becc642c9f16557dfc2c2d593a602b5
|
|
BLAKE2b-256 checksum How to use checksums |
e6471c1aed3d13b27437a0082b4dc4ad0e4c8f407d0e1c0e2a6fcdc3b207ff14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / time_series_model_basics-0.0.5-py3-none-any.whl
| Download URL | time_series_model_basics-0.0.5-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06b67500fc42d20810a27a33c4bf1933f145932df99814ef2aa705ce943c640c
|
|
BLAKE2b-256 checksum How to use checksums |
15acb2694e88a99a4efbcb6f30a53b060bd6504d340cda7d3326ec75f12f1d61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|