skillfed

patsy

A Python package for describing statistical models and for building design matrices.

patsy Permissive license 2-clause BSD Active 989 v1.0.2 released

Install

patsy on PyPI

pip

pip install patsy

uv

uv add patsy

poetry

poetry add patsy

Package facts

License 2-clause BSD (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 297 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: patsy-1.0.2-py2.py3-none-any.whl

Development Status :: 6 - MatureIntended Audience :: DevelopersIntended Audience :: Financial and Insurance IndustryIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering

About patsy

from the package's own PyPI description — quoted content, verbatim

Patsy

Notice: patsy is no longer under active development. As of August 2021, Matthew Wardrop (@matthewwardrop) and Tomás Capretto (@tomicapretto) have taken on responsibility from Nathaniel Smith (@njsmith) for keeping the lights on, but no new feature development is planned. The spiritual successor of this project is Formulaic, and we recommend that users migrate when possible. For the time being, until major software packages have successfully transitioned, we will attempt to keep patsy working in its current state with current releases in the Python ecosystem.


Patsy is a Python library for describing statistical models (especially linear models, or models that have a linear component) and building design matrices. Patsy brings the convenience of R "formulas" to Python.

PyPI - Version (image) ![PyPI - Python...

Read as markdown · JSON record · Source repository · Homepage

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

Patsy builds design matrices for statistical models using R-style formula syntax, enabling convenient specification of linear models and related statistical analyses in Python.

Installation is straightforward with a single runtime dependency (numpy) and a pure-Python wheel. The package is actively maintained despite being in maintenance-only mode; the last commit is recent and the repository remains active.

Patsy is licensed under the 2-clause BSD license, a permissive open-source license that allows commercial and private use with minimal restrictions beyond attribution and liability disclaimers.

Usage

pip install patsy
import patsy
design_matrix = patsy.dmatrix('y ~ x1 + x2', data={'y': [1, 2, 3], 'x1': [0, 1, 2], 'x2': [1, 1, 1]})

Requires Python 3.6 or later; scipy is optional but needed for spline functions like bs().

Verdict: Patsy is a mature, well-maintained library for statistical model specification that fills a specific niche in bringing R's formula convenience to Python. While no new features are planned and the project recommends Formulaic for new work, it remains actively supported for current Python versions and carries no known vulnerabilities, making it safe for existing codebases.

Needs verification

  • Whether scipy integration for spline functions (bs, cc, etc.) is fully tested in current Python 3.10–3.13 environments
  • Adoption rate and stability track record among major downstream packages (statsmodels, scikit-learn, etc.) that may depend on patsy
statistical model formula syntaxdesign matrix builderR formula to Pythonlinear model specificationstatistical modeling DSLpatsy formula parsermodel matrix construction

Similar packages