formulaic
An implementation of Wilkinson formulas.
Decision gist · record as of 2026-08-14
Yes. Formulaic is actively maintained, MIT-licensed, has low install friction, and fills a clear gap as a high-performance successor to patsy for formula-based model matrix generation. It supports modern dataframe libraries (Polars, PyArrow) and is already adopted by established projects like Glum, Lifelines, and Linearmodels. No known vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction installation with seven runtime dependencies (numpy, pandas, scipy, narwhals, interface-meta, typing-extensions, wrapt).
- Active maintenance with a recent release 73 days ago.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted commercial and private use, modification, and distribution with minimal obligations.
last release 2026-06-02 (73 days) · last repo commit 2026-08-12 · 463 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,889,607 downloads/mo, #2,459 on PyPI
Alternatives
Verify before relying
pip install formulaic
from formulaic import Formula
import pandas
df = pandas.DataFrame({'y': [0, 1, 2], 'x': ['A', 'B', 'C'], 'z': [0.3, 0.1, 0.2]})
y, X = Formula('y ~ x + z').get_model_matrix(df)- Whether symbolic differentiation of formulas is production-ready or experimental
- Performance benchmarks against R and patsy on current hardware
- Extent of narwhals integration beyond the listed dataframe types
What it is and what it does
Formulaic is a Python implementation of Wilkinson formulas—a domain-specific language for specifying statistical model matrices from tabular data. It takes a formula string like 'y ~ x + z' and a dataframe, then automatically handles categorical encoding, intercept inclusion, and matrix construction. The package outputs model matrices as pandas DataFrames, NumPy arrays, or SciPy sparse matrices, making it useful for feeding data into machine learning and statistical models.
The library supports input from pandas, Polars, PyArrow, and any dataframe library compatible with narwhals. It also allows encoding choices from one dataset to be reused on others, supports symbolic differentiation of formulas, and includes extensible plugins for custom input/output formats. Seven runtime dependencies (numpy, pandas, scipy, narwhals, interface-meta, typing-extensions, wrapt) keep the installation lightweight.
Use it for
- Prepare training data for linear regression or GLM models by converting formulas into design matrices with automatic categorical encoding.
- Reuse categorical encodings learned on a training set when transforming new test or production data.
- Work with Polars or PyArrow dataframes while maintaining formula-based data transformation workflows.
- Generate sparse model matrices for high-dimensional datasets to reduce memory footprint.
- Integrate formula-based preprocessing into statistical modeling pipelines used by statsmodels or custom estimators.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Formulaic is actively maintained, MIT-licensed, has low install friction, and fills a clear gap as a high-performance successor to patsy for formula-based model matrix generation. It supports modern dataframe libraries (Polars, PyArrow) and is already adopted by established projects like Glum, Lifelines, and Linearmodels. No known vulnerabilities.
Install
formulaic on PyPI
Before you install
Low friction installation with seven runtime dependencies (numpy, pandas, scipy, narwhals, interface-meta, typing-extensions, wrapt). Active maintenance with a recent release 73 days ago.
License in practice
MIT license permits unrestricted commercial and private use, modification, and distribution with minimal obligations.
Quickstart
pip install formulaic
from formulaic import Formula
import pandas
df = pandas.DataFrame({'y': [0, 1, 2], 'x': ['A', 'B', 'C'], 'z': [0.3, 0.1, 0.2]})
y, X = Formula('y ~ x + z').get_model_matrix(df)
Verify before relying
- Whether symbolic differentiation of formulas is production-ready or experimental
- Performance benchmarks against R and patsy on current hardware
- Extent of narwhals integration beyond the listed dataframe types
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesinterface-metanarwhalsnumpypandasscipytyping-extensionswrapt |
| Maintenance | Actively maintained 73 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,889,607 / month, #2,459 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Mathematics |
Evidence: formulaic-1.2.2-py3-none-any.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 › “wilkinson formulas python”
- formulaicFormulaic converts tabular data into model matrices using Wilkinson…
- formulasParses and compiles Excel formulas and workbooks into executable…
- xlcalculatorReads MS Excel files and translates Excel formulas into Python code…
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 fastf1 · formulaic-contrasts · patsy · tabmat · spglm · formulas · itables · qdldl · narwhals · anndata