
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Formulaic is a high-performance implementation of Wilkinson formulas for Python.
It provides:
pandas.DataFrame
narwhals
including
pyarrow.Table
polars.DataFrame
pandas.DataFrame
numpy.ndarray
scipy.sparse.CSCMatrix
narwhals
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
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.