Skip to main content

python package for generating calendars for machine learning timeseries analysis.

Project description

lilio: Calendar generator for machine learning with timeseries data


github repo badge github license badge fair-software badge

A python package for generating calendars to resample timeseries into training and target data for machine learning.


To install the in-development version from the GitHub repository, do:

python3 -m pip install git+

Configure the package for development and testing

The testing framework used here is pytest. Before running the test, we get a local copy of the source code and install lilio via the command:

git clone
cd lilio
python3 -m pip install -e .

Then, run tests:

python3 -m pytest

How the lilio calendars work

In a typical ML-based timeseries analysis, the first step is always data processing. A calendar-based datetime module time is implemented for time operations. For instance, a user is looking for predictors for winter climate at seasonal timescales (~180 days). First, a calendar object is created using AdventCalendar:

>>> calendar = s2spy.time.AdventCalendar(anchor="11-30", freq='180d')
>>> calendar = calendar.map_years(2020, 2021)
i_interval                         -1                         1
2021         [2021-06-03, 2021-11-30)  [2021-11-30, 2022-05-29)
2020         [2020-06-03, 2020-11-30)  [2020-11-30, 2021-05-29)

Now, the user can load the data input_data (e.g. pandas DataFrame) and resample it to the desired timescales configured in the calendar:

>>> calendar = calendar.map_to_data(input_data)
>>> bins = s2spy.time.resample(calendar, input_data)
>>> bins
  anchor_year  i_interval                  interval  mean_data  target
0        2020          -1  [2020-06-03, 2020-11-30)      275.5    True
1        2020           1  [2020-11-30, 2021-05-29)       95.5   False
2        2021          -1  [2021-06-03, 2021-11-30)      640.5    True
3        2021           1  [2021-11-30, 2022-05-29)      460.5   False

Depending on data preparations, we can choose different types of calendars e.g. MonthlyCalendar and WeeklyCalendar.


If you want to contribute to the development of lilio, have a look at the contribution guidelines.


This package was created with Cookiecutter and the NLeSC/python-template.

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

lilio-0.2.1.tar.gz (1.5 MB view hashes)

Uploaded Source

Built Distribution

lilio-0.2.1-py3-none-any.whl (30.6 kB view hashes)

Uploaded Python 3

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