skillfed

polars-ds

polars-ds v0.12.0 177.8K downloads/30d#10,205 on PyPI
Permissive license Active released

What it is and what it does

Polars-ds is a Polars extension that brings data science and statistical modeling directly into lazy dataframe expressions. It lets you compute ML metrics, fit regression models, run statistical tests, and calculate string/array distances all within Polars' query engine, avoiding intermediate data copies. The package covers linear regression (with L1/L2 regularization), logistic regression, rolling and recursive regression, statistical tests (t-test, chi-squared, F-test), string distances (Levenshtein, Jaro-Winkler, OSA), and array distances. Models are non-persistent—fit and predict in a single expression—and work alongside Polars' group_by and lazy evaluation.

It requires Python 3.9+ and depends only on polars and typing-extensions. The package is written in Rust for performance and ships as compiled wheels for macOS (x86_64 and arm64), Linux (x86_64 and aarch64), and Windows. It is in Beta status and actively maintained.

Use it for:

  • Compute ML evaluation metrics (ROC-AUC, log-loss) in parallel across data segments using group_by.
  • Fit and predict with linear or logistic regression inline within a Polars expression without materializing intermediate tables.
  • Generate polynomial features and produce statsmodels-style regression summaries with coefficients, p-values, and confidence intervals.
  • Calculate string edit distances (Levenshtein, Jaro-Winkler) or array distances (squared L2) for fuzzy matching or similarity scoring.
  • Run statistical hypothesis tests (t-test, chi-squared, F-test) grouped by category within a single lazy query.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Polars-ds adds data science and machine learning operations to Polars dataframes, including linear regression, logistic regression, statistical tests, string and array distances, and feature engineering transforms.

Yes, if you work with Polars and need inline statistical modeling or ML metrics. The permissive MIT license, minimal dependencies, and active maintenance make it low-risk. Medium install friction (compiled wheels) is typical for performance-critical packages. Beta status is acceptable for exploratory or non-critical workflows; verify stability requirements for production use.

Install

polars-ds on PyPI

pip

pip install polars-ds

uv

uv add polars-ds

poetry

poetry add polars-ds

Installing polars-ds

Before you install

Medium install friction due to compiled wheels across multiple platforms (x86_64, arm64, Windows). Active maintenance with recent release (74 days ago). Minimal runtime dependencies: only polars and typing-extensions.

License in practice

MIT license (permissive) allows commercial and private use without restriction.

Quickstart

pip install polars-ds

import polars as pl
import polars_ds as pds

df = pl.DataFrame({"x1": [1.0, 2.0], "x2": [3.0, 4.0], "y": [5.0, 6.0]})
result = df.select(pds.lin_reg(pl.col("x1"), pl.col("x2"), target=pl.col("y")))

Requires Python 3.9+. Compiled wheels available for macOS (x86_64, arm64), Linux (x86_64, aarch64), and Windows (x86_64); other platforms may require building from source.

Verify before relying

  • Whether the package supports GPU acceleration or only CPU computation.
  • Performance characteristics compared to scikit-learn or statsmodels for the same operations.
  • Stability guarantees given Beta development status.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 2 — polars, typing-extensions
Maintenance actively maintained — 74 days since the last release
First released
Downloads 177,847/month — #10,205 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: polars_ds-0.12.0-cp39-abi3-macosx_10_12_x86_64.whl; polars_ds-0.12.0-cp39-abi3-macosx_11_0_arm64.whl; polars_ds-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; polars_ds-0.12.0-cp39-abi3-manylinux_2_24_aarch64.whl; polars_ds-0.12.0-cp39-abi3-win_amd64.whl

Keywords: polars-extension, scientific-computing, data-science

Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust

Tags

polars machine learning extensiondataframe linear regressionstatistical tests in polarsstring distance metricsfeature engineering polars
polars-extensionstatistical-modelingfeature-engineering

More Scientific/Engineering packages