utilsforecast
Install
pip install utilsforecast
How to use
Generate synthetic data
from utilsforecast.data import generate_series
series = generate_series(3, with_trend=True, static_as_categorical=False)
series
| unique_id | ds | y | |
|---|---|---|---|
| 0 | 0 | 2000-01-01 | 0.422133 |
| 1 | 0 | 2000-01-02 | 1.501407 |
| 2 | 0 | 2000-01-03 | 2.568495 |
| 3 | 0 | 2000-01-04 | 3.529085 |
| 4 | 0 | 2000-01-05 | 4.481929 |
| ... | ... | ... | ... |
| 481 | 2 | 2000-06-11 | 163.914625 |
| 482 | 2 | 2000-06-12 | 166.018479 |
| 483 | 2 | 2000-06-13 | 160.839176 |
| 484 | 2 | 2000-06-14 | 162.679603 |
| 485 | 2 | 2000-06-15 | 165.089288 |
486 rows × 3 columns
Plotting
from utilsforecast.plotting import plot_series
plot_series(series, plot_random=False, max_insample_length=50, engine='matplotlib')
Preprocessing
from utilsforecast.preprocessing import fill_gaps
serie = series[series['unique_id'].eq(0)].tail(10)
# drop some points
with_gaps = serie.sample(frac=0.5, random_state=0).sort_values('ds')
with_gaps
| unique_id | ds | y | |
|---|---|---|---|
| 213 | 0 | 2000-08-01 | 18.543147 |
| 214 | 0 | 2000-08-02 | 19.941764 |
| 216 | 0 | 2000-08-04 | 21.968733 |
| 220 | 0 | 2000-08-08 | 19.091509 |
| 221 | 0 | 2000-08-09 | 20.220739 |
fill_gaps(with_gaps, freq='D')
| unique_id | ds | y | |
|---|---|---|---|
| 0 | 0 | 2000-08-01 | 18.543147 |
| 1 | 0 | 2000-08-02 | 19.941764 |
| 2 | 0 | 2000-08-03 | NaN |
| 3 | 0 | 2000-08-04 | 21.968733 |
| 4 | 0 | 2000-08-05 | NaN |
| 5 | 0 | 2000-08-06 | NaN |
| 6 | 0 | 2000-08-07 | NaN |
| 7 | 0 | 2000-08-08 | 19.091509 |
| 8 | 0 | 2000-08-09 | 20.220739 |
Release files for utilsforecast 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| utilsforecast-0.0.2.tar.gz | 18.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| utilsforecast-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.5 kB
Release files / utilsforecast-0.0.2.tar.gz
| Download URL | utilsforecast-0.0.2.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
784f4ecc0ac59fcf207652c9de1c9fd16991dd448dd5375826365d90011b88fb
|
|
BLAKE2b-256 checksum How to use checksums |
4733cc150081e0f9985fb276a989ef8ebe944f44d151137c3047f24169e5426f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / utilsforecast-0.0.2-py3-none-any.whl
| Download URL | utilsforecast-0.0.2-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e772a99c72e49fe008be53703003fd9213432444b75b10c52ee2c567a91acba0
|
|
BLAKE2b-256 checksum How to use checksums |
9cdb2e921ea2a97c4be817d24973b15d32de7416ce4c4f48f7050a9cd2786606
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|