Metadata-Version: 2.4
Name: polars-timeseries
Version: 0.1.0
Requires-Dist: hvplot >=0.11.2
Requires-Dist: matplotlib >=3.10.0
Requires-Dist: polars >=1.20.0
Requires-Dist: iprogress >=0.4
Requires-Dist: loguru >=0.7.3
Requires-Dist: statsforecast >=2.0.0
Requires-Dist: pyarrow >=19.0.0
Requires-Dist: maturin >=1.8.1
Summary: Polars Time Series Extension
Author: Jack Rodenberg, Torben Windler
Requires-Python: >=3.12, <3.13
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source, https://github.com/drumtorben/polars-ts.git

# Polars Time Series Extension

Welcome to the documentation for the **Polars Time Series Extension**.

---

**Documentation**: [https://drumtorben.github.io/polars-ts](https://drumtorben.github.io/polars-ts)

**Source Code**: [https://github.com/drumtorben/polars-ts](https://github.com/drumtorben/polars-ts)

---

## 📖 Overview

The **Polars Time Series Extention** offers a wide range of metrics, feature extractors, and various tools for time series forecasting.

## Installation

`pip install polars-timeseries`

## How to use

The `polars-ts` plugin is available under the namespace `ts`.
See the following example where we compute the Kaboudan metric:

```python
import polars as pl
from statsforecast import StatsForecast
from statsforecast.models import AutoETS, OptimizedTheta

import polars_ts as pts  # noqa

# Create sample dataframe with columns `unique_id`, `ds`, and `y`.
df = (
    pl.scan_parquet("https://datasets-nixtla.s3.amazonaws.com/m4-hourly.parquet")
    .filter(pl.col("unique_id").is_in(["H1", "H2", "H3"]))
    .collect()
)

# Define models
season_length = 24
models = [
    OptimizedTheta(season_length=season_length, decomposition_type="additive"),
    AutoETS(season_length=season_length),
]
sf = StatsForecast(models=models, freq=1, n_jobs=-1)

# Compute the Kaboudan metric in the `ts` namespace
res = df.ts.kaboudan(sf, block_size=200, backtesting_start=0.5, n_folds=10)
```
