mockseries is an easy to use and intuitive Python package that helps generate synthetic (mock) timeseries.
#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 |
Contributions are welcome!
Standards, objectives and process not defined yet.
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
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)
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")
- J. R. Maat, A. Malali, and P. Protopapas, “TimeSynth: A Multipurpose Library for Synthetic Time Series in Python,” 2017. [Online]. Available: http://github.com/TimeSynth/TimeSynth.
- TStimulus. Available: https://github.com/cetic/TSimulus.