polars-ols
Polars Least Squares Extension
Decision gist · record as of 2026-08-14
Yes, if you are already using Polars and need to fit linear models without leaving the Polars ecosystem or converting to external libraries. No, if the package is dormant (last release 719 days ago, no visible recent commits) and you need active maintenance or bug fixes. Verify the license before use in proprietary projects.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires polars to be installed first.
- Python >= 3.8.
- Medium install friction due to compiled wheels for multiple platforms (cp38-abi3 across macOS, Linux, Windows architectures).
License · maintenance · safety
(unclear) — License treatment is unclear—no SPDX identifier or raw license text provided in metadata. Verify the actual license before adopting in proprietary or restricted-license projects.
last release 2024-08-25 (719 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 102,855 downloads/mo, #12,841 on PyPI
Alternatives
Verify before relying
pip install polars-ols
import polars as pl
import polars_ols as pls
df = pl.DataFrame({"y": [1.16, -2.16], "x1": [0.72, -2.43], "x2": [0.24, 0.18]})
predictions = df.with_columns(
pl.col("y").least_squares.ols(pl.col("x1", "x2"), add_intercept=True).alias("pred")
)- Whether the package is actively maintained or seeking new maintainers (dormant status, no recent commits)
- Actual license terms and compatibility with your project's licensing constraints
- Performance benchmarks relative to scikit-learn or statsmodels for your specific use case
- Whether formula API (patsy syntax) is fully documented and stable
What it is and what it does
Polars OLS is a Rust-based extension that adds least-squares regression capabilities directly to Polars DataFrames. It implements common linear regression variants—ordinary least squares, weighted least squares, Ridge, Elastic Net, non-negative least squares, and recursive least squares—and exposes them as Polars expressions that integrate seamlessly into Polars' lazy evaluation and grouping workflows.
Instead of converting data to NumPy or scikit-learn, you chain regression calls like any other Polars expression, supporting sample weighting, L1/L2 regularization, non-negativity constraints, and a patsy-style formula API. It can compute predictions, residuals, coefficients, or statistical summaries (for OLS/WLS/Ridge), and scales across groups via `.over()` or `.group_by()` with native Rust parallelism.
Use it for
- Fit OLS or Ridge models within a Polars pipeline without leaving lazy evaluation or converting to NumPy
- Compute per-group regression coefficients using `.group_by()` or `.over()` in parallel
- Build weighted least-squares models with sample weights directly from a Polars column
- Extract statistical summaries (R², MAE, MSE, p-values) for OLS/WLS/Ridge models in one expression
- Use patsy formula syntax (e.g., 'y ~ x1 + x2 + x1:x2') to specify models without manual feature engineering
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are already using Polars and need to fit linear models without leaving the Polars ecosystem or converting to external libraries.
No, if the package is dormant (last release 719 days ago, no visible recent commits) and you need active maintenance or bug fixes. Verify the license before use in proprietary projects.
Install
polars-ols on PyPI
Before you install
Medium install friction due to compiled wheels for multiple platforms (cp38-abi3 across macOS, Linux, Windows architectures). Single runtime dependency on polars. Maintenance status is dormant: last release was 719 days ago with no recent commits visible.
Requires polars to be installed first. Python >= 3.8.
License in practice
License treatment is unclear—no SPDX identifier or raw license text provided in metadata. Verify the actual license before adopting in proprietary or restricted-license projects.
Quickstart
pip install polars-ols
import polars as pl
import polars_ols as pls
df = pl.DataFrame({"y": [1.16, -2.16], "x1": [0.72, -2.43], "x2": [0.24, 0.18]})
predictions = df.with_columns(
pl.col("y").least_squares.ols(pl.col("x1", "x2"), add_intercept=True).alias("pred")
)
Verify before relying
- Whether the package is actively maintained or seeking new maintainers (dormant status, no recent commits)
- Actual license terms and compatibility with your project's licensing constraints
- Performance benchmarks relative to scikit-learn or statsmodels for your specific use case
- Whether formula API (patsy syntax) is fully documented and stable
Package facts
| License | Not declared unclear |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagepolars |
| Maintenance | Dormant 719 days since the last release |
| First released | |
| Downloads | 102,855 / month, #12,841 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust |
Evidence: polars_ols-0.3.5-cp38-abi3-macosx_10_12_x86_64.whl; polars_ols-0.3.5-cp38-abi3-macosx_11_0_arm64.whl; polars_ols-0.3.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; polars_ols-0.3.5-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; polars_ols-0.3.5-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl; polars_ols-0.3.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; polars_ols-0.3.5-cp38-abi3-win32.whl; polars_ols-0.3.5-cp38-abi3-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “polars linear regression”
- polars-olsPolars OLS provides Rust-optimized linear regression models (OLS,…
- polars-dsPolars-ds adds data science and machine learning operations to Polars…
- glumglum is a high-performance Python library for fitting generalized…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also polars · polars-runtime-32 · polars-ds · polars-lts-cpu · polars-runtime-64 · polars-runtime-compat · spglm · linearmodels · pyfixest · polars-hash