Skip to main content

Easy and intuitive generation of synthetic timeseries.

Project description

mockseries

mockseries is and easy to use and intuitive Python package that helps generate synthetic (mock) timeseries.

-> Documentation website.

Installation

#python >=3.9
pip install mockseries

For older versions of python, here is the compatibility matrix:

mockseries version Python versions
0.3.x 3.9 - 3.12
0.2.x 3.8 - 3.11
0.1.x 3.6 - 3.8

Contributing

Contributions are welcome!
Standards, objectives and process not defined yet.

Quick Run

Define a timeseries

from datetime import timedelta
from mockseries.trend import LinearTrend
from mockseries.seasonality import SinusoidalSeasonality
from mockseries.noise import RedNoise

trend = LinearTrend(coefficient=2, time_unit=timedelta(days=4), flat_base=100)
seasonality = SinusoidalSeasonality(amplitude=20, period=timedelta(days=7)) \
              + SinusoidalSeasonality(amplitude=4, period=timedelta(days=1))
noise = RedNoise(mean=0, std=3, correlation=0.5)

timeseries = trend + seasonality + noise

Generate values

from datetime import datetime
from mockseries.utils import datetime_range

ts_index = datetime_range(
    granularity=timedelta(hours=1),
    start_time=datetime(2021, 5, 31),
    end_time=datetime(2021, 8, 30),
)
ts_values = timeseries.generate(ts_index)

Plot or write to csv

from mockseries.utils import plot_timeseries, write_csv

print(ts_index, ts_values)
plot_timeseries(ts_index, ts_values, save_path="hello_mockseries.png")
write_csv(ts_index, ts_values, "hello_mockseries.csv")

References

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

mockseries-0.3.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

mockseries-0.3.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file mockseries-0.3.1.tar.gz.

File metadata

  • Download URL: mockseries-0.3.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for mockseries-0.3.1.tar.gz
Algorithm Hash digest
SHA256 dcf310c441590a93df5f025245dcfbeb8e38048f9e27d73b4d66475dd0eeb8cd
MD5 b942d706aa63e184ea06948cd51db50d
BLAKE2b-256 5cc18cb7e85f18a943dbd46a4fab1bdca123dcb33b9e331a11bff8ee3826f7fb

See more details on using hashes here.

File details

Details for the file mockseries-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: mockseries-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for mockseries-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a44ee649a45dce8af729fc2d1baabbbbf424682371b99b9ff1e75e4d0c755965
MD5 4baec907a583e4d506c52757d1dafd75
BLAKE2b-256 7fcfbcd47cd293d2a802e7e077fc2cc7a7efd244fa1b025f5b39d03288f2968f

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