
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Formulaic is a high-performance implementation of Wilkinson formulas for Python.
It provides:
pandas.DataFramenarwhals including
pyarrow.Tablepolars.DataFramepandas.DataFramenumpy.ndarrayscipy.sparse.CSCMatrixnarwhals dataframe passthrough when using narwhals dataframes.import pandas
from formulaic import Formula
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)
y =
| y | |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
X =
| Intercept | x[T.B] | x[T.C] | z | |
|---|---|---|---|---|
| 0 | 1.0 | 0 | 0 | 0.3 |
| 1 | 1.0 | 1 | 0 | 0.1 |
| 2 | 1.0 | 0 | 1 | 0.2 |
Note that the above can be short-handed to:
from formulaic import model_matrix
model_matrix('y ~ x + z', df)
Formulaic typically outperforms R for both dense and sparse model matrices, and vastly outperforms patsy (the existing implementation for Python) for dense matrices (patsy does not support sparse model matrix output).

For more details, see here.
@formula: The implementation of Wilkinson formulas for Julia.Below are some of the projects that use Formulaic:
FAQs
An implementation of Wilkinson formulas.
We found that formulaic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.