Skip to main content

Time-series machine learning at scale


functime Python PyPi uv Code style: black GitHub Run Quickstart Discord


functime is a powerful Python library for production-ready global forecasting and time-series feature extraction on large panel datasets.

functime also comes with time-series preprocessing (box-cox, differencing etc), cross-validation splitters (expanding and sliding window), and forecast metrics (MASE, SMAPE etc). All optimized as lazy Polars transforms.

Join us on Discord!

Highlights

  • Fast: Forecast and extract features (e.g. tsfresh, Catch22) across 100,000 time series in seconds on your laptop
  • Efficient: Embarrassingly parallel feature engineering for time-series using Polars
  • Battle-tested: Machine learning algorithms that deliver real business impact and win competitions
  • Exogenous features: supported by every forecaster
  • Backtesting with expanding window and sliding window splitters
  • Automated lags and hyperparameter tuning using FLAML

Additional Highlights

functime comes with a specialized LLM agent to analyze, describe, and compare your forecasts. Check out the walkthrough here.

Getting Started

Install functime using uv (recommended) or pip:

# Using uv (recommended)
uv add functime

# Or using pip
pip install functime

functime comes with extra options. For example, to install functime with large-language model (LLM) and lightgbm features:

# Using uv (recommended)
uv add "functime[llm,lgb]"

# Or using pip
pip install "functime[llm,lgb]"
  • cat: To use catboost forecaster
  • xgb: To use xgboost forecaster
  • lgb: To use lightgbm forecaster
  • llm: To use the LLM-powered forecast analyst

Forecasting

import polars as pl
from functime.cross_validation import train_test_split
from functime.seasonality import add_fourier_terms
from functime.forecasting import linear_model
from functime.preprocessing import scale
from functime.metrics import mase

# Load commodities price data
y = pl.read_parquet("https://github.com/functime-org/functime/raw/main/data/commodities.parquet")
entity_col, time_col = y.columns[:2]

# Time series split
y_train, y_test = y.pipe(train_test_split(test_size=3))

# Fit-predict
forecaster = linear_model(freq="1mo", lags=24)
forecaster.fit(y=y_train)
y_pred = forecaster.predict(fh=3)

# functime ❤️ functional design
# fit-predict in a single line
y_pred = linear_model(freq="1mo", lags=24)(y=y_train, fh=3)

# Score forecasts in parallel
scores = mase(y_true=y_test, y_pred=y_pred, y_train=y_train)

# Forecast with target transforms and feature transforms
forecaster = linear_model(
    freq="1mo",
    lags=24,
    target_transform=scale(),
    feature_transform=add_fourier_terms(sp=12, K=6)
)

# Forecast with exogenous regressors!
# Just pass them into X
X = (
    y.select([entity_col, time_col])
    .pipe(add_fourier_terms(sp=12, K=6)).collect()
)
X_train, X_future = y.pipe(train_test_split(test_size=3))
forecaster = linear_model(freq="1mo", lags=24)
forecaster.fit(y=y_train, X=X_train)
y_pred = forecaster.predict(fh=3, X=X_future)

View the full walkthrough on forecasting here.

Feature Extraction

functime comes with over 100+ time-series feature extractors. Every feature is easily accessible via functime's custom ts (time-series) namespace, which works with any Polars Series or expression. To register the custom ts Polars namespace, you must first import functime in your module.

To register the custom ts Polars namespace, you must first import functime!

import polars as pl
import numpy as np
from functime.feature_extractors import FeatureExtractor, binned_entropy

# Load commodities price data
y = pl.read_parquet("https://github.com/functime-org/functime/raw/main/data/commodities.parquet")

# Get column names ("commodity_type", "time", "price")
entity_col, time_col, value_col = y.columns

# Extract a single feature from a single time-series
binned_entropy = binned_entropy(
    pl.Series(np.random.normal(0, 1, size=10)),
    bin_count=10
)

# 🔥 Also works on LazyFrames with query optimization
features = (
    pl.LazyFrame({
        "index": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
        "value": np.random.normal(0, 1, size=10)
    })
    .select(
        binned_entropy=pl.col("value").ts.binned_entropy(bin_count=10),
        lempel_ziv_complexity=pl.col("value").ts.lempel_ziv_complexity(threshold=3),
        longest_streak_above_mean=pl.col("value").ts.longest_streak_above_mean(),
    )
    .collect()
)

# 🚄 Extract features blazingly fast on many
# stacked time-series using `group_by`
features = (
    y.group_by(entity_col)
    .agg(
        binned_entropy=pl.col(value_col).ts.binned_entropy(bin_count=10),
        lempel_ziv_complexity=pl.col(value_col).ts.lempel_ziv_complexity(threshold=3),
        longest_streak_above_mean=pl.col(value_col).ts.longest_streak_above_mean(),
    )
)

# 🚄 Extract features blazingly fast on windows
# of many time-series using `group_by_dynamic`
features = (
    # Compute rolling features at yearly intervals
    y.group_by_dynamic(
        time_col,
        every="12mo",
        group_by=entity_col,
    )
    .agg(
        binned_entropy=pl.col(value_col).ts.binned_entropy(bin_count=10),
        lempel_ziv_complexity=pl.col(value_col).ts.lempel_ziv_complexity(threshold=3),
        longest_streak_above_mean=pl.col(value_col).ts.longest_streak_above_mean(),
    )
)

Related Projects

If you are interested in general data-science related plugins for Polars, you must check out polars-ds. polars-ds is a project created by one of functime's core maintainers and is the easiest way to extend your Polars pipelines with commonly used data-science operations made blazing fast with Rust!

License

functime is distributed under Apache-2.0.

Metadata

Release files for functime 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for functime 1.0.0
File Size Uploaded
functime-1.0.0.tar.gz 316.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for functime 1.0.0
File
functime-1.0.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
functime-1.0.0-cp311-abi3-win32.whl CPython 3.11 abi3 Windows x86-32 Details
functime-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
functime-1.0.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-32 Details
functime-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
functime-1.0.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
functime-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 34.9 MB

Release files / functime-1.0.0.tar.gz

Download URL functime-1.0.0.tar.gz
Size 316.8 kB
Tags Source
SHA-256 checksum
How to use checksums
80c617848fce3a731fe37bbf2d01929f77e2da856fa1ebc7f6d37cdca881bb4d
BLAKE2b-256 checksum
How to use checksums
690d325289155db1e3f31b3b9bd531d68d26de00f77f2004aa8a421e12444677
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-win_amd64.whl

Download URL functime-1.0.0-cp311-abi3-win_amd64.whl
Size 4.6 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
bff6febec6c5033d33e1ed59e5437fafffd676e43e32c0dec71a1125daaec1b6
BLAKE2b-256 checksum
How to use checksums
6c05e4b3eb4f385ea86ee436b00a87622f056f0a0667a9c3fcc311bbf6727429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-win32.whl

Download URL functime-1.0.0-cp311-abi3-win32.whl
Size 3.9 MB
Tags CPython 3.11 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
71ee1048101cd36cc8e7931464cf5c96c77f5fd61c2a7318ff6bd318a7b27043
BLAKE2b-256 checksum
How to use checksums
8c6aeb4b060fecb57ae845d59728a336a2e3890010b4c51313a4c0347339126c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL functime-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.5 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f0ea07d79bb07621930f567cfd12cdd8c41c1657325b440fa79190c537a8adee
BLAKE2b-256 checksum
How to use checksums
aa838a377ea67227775bd8047e496f5a915e47b728046ad3e101becd57e467e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL functime-1.0.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 5.9 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
39f616a20266c99f8ecf07fecb141546c6028917055c36642d33881e4a684a3b
BLAKE2b-256 checksum
How to use checksums
08d774e6da8ce666c10a535749fc87e47c70bdd7948cb8c3c6ac0906b6919564
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL functime-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.1 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
0159f12e8afb0c8cc79677409c4e2aa4d53d12d66181604c045ddacafcbebf18
BLAKE2b-256 checksum
How to use checksums
53ef4c6b80aa3b476f4232de4e6c1874ff1f78e0e1f69a5a8f54a4b9ae0f0ceb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL functime-1.0.0-cp311-abi3-macosx_11_0_arm64.whl
Size 4.6 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cc42903e85387ce167b7cb30e80f72e9aa92c457b856f24573c38ee5f28b6d29
BLAKE2b-256 checksum
How to use checksums
190115ebec617b1fde44e4b4af923c3628c3484addb228303516e51fe2d105ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release files / functime-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL functime-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9caf7d7de774f9ef2197cb5be97edf18cff24ce5da2c8727d8d36bd20fcca037
BLAKE2b-256 checksum
How to use checksums
383dad025639b1b56bb2ee334bcc760133a071f33e9512380f0d8b8f1d347594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

8 release files

0.9.5

45 release files

0.9.4

45 release files

0.9.2

46 release files

0.9.1

45 release files

0.8.5

46 release files

0.8.4

61 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page