NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #596 most downloaded on PyPI
A Python package for describing statistical models and for building design matrices.
Last release 1 months ago
29 Aug 2026
Release timing varies
gaps range from 1 weeks to 2.9 years
Nearly every release is documented
notes for 15 of 15 stable releases
2 versions withdrawn
withdrawn after publishing
14 years old
17 releases · first in 2012
Added official support for Python 3.14.
Full Changelog: v1.0.2...v1.0.3
Fixes compatibility with Pandas 3's new StringDtype .
This is a minor release that:
StringDtype.There are no other changes compared to 1.0.1, and all users are recommended to upgrade.
Full Changelog: v1.0.1...v1.0.2
One column per quarter.
Fixed compatibility with Pandas 3's new StringDtype.
This is a bug fix release that:
This is a bug fix release that:
There are no other changes from 1.0.0.
This is a major release that bumps the version to 1.0.0 to reflect the maturity of the project, and drops support for Python 2.
This is a major release that bumps the version to 1.0.0 to reflect the maturity of the project, and drops support for Python 2.
six module (thanks @a-detiste).numpy >= 2 (thanks @natsukium).Add support for Python 3.13.
Drop support for Python 2.7 (and remove dependency on the six module).
Fix compatibility with numpy >= 2.
Update development status to 'mature'.
This is a minor release pre-empting some upstream deprecations in numpy and pandas .
This is a minor release pre-empting some upstream deprecations in numpy and pandas.
is_categorical_dtype from pandas at all in pandas >=0.25. (thanks @EpigeneMax, @lesteve, @bashtage)numpy.row_stack in favor of numpy.vstack in preparation from numpy 2.0. (thanks @bashtage)Avoid using deprecated is_categorical_dtype from pandas at all in pandas >=0.25.
Avoid using deprecated numpy.row_stack in favor of numpy.vstack.
Handle deprecation of _is_categorical_dtype in pandas .
This is a minor release fixing compatibility with upstream pandas and numpy changes:
_is_categorical_dtype in pandas.numpy.issubsctype usage with numpy.issubdtype for compatibility with numpy 2.0.This is a minor release that adds support for Python 3.12. No other changes were made.
This is a minor release that adds support for Python 3.12. No other changes were made.
Add support for Python 3.12, and fix broken unit tests in this version.
This release is a minor patch release adding formal support for Python 3.10 and 3.11, and fixing a bug in the handling of future interpreter features
This release is a minor patch release adding formal support for Python 3.10 and 3.11, and fixing a bug in the handling of future interpreter features that are no longer guaranteed to be delivered.
For more details, refer to the release notes: http://patsy.readthedocs.org/en/latest/changes.html#v0-5-3.
Officially add support for Python 3.10 and 3.11, and extend test coverage to include these releases.
Fix handling of future interpreter features that no longer have a mandatory release version, as for the annotations feature (See #187 for details.)
This is a patch release fixing some deprecation warnings associated with importing from the collections module (rather than collections.abc ) in Pytho…
This is a patch release fixing some deprecation warnings associated with importing from the collections module (rather than collections.abc) in Python 3.7+.
See release notes: http://patsy.readthedocs.org/en/latest/changes.html#v0-5-1
See release notes: http://patsy.readthedocs.org/en/latest/changes.html#v0-5-1
See release notes: http://patsy.readthedocs.org/en/latest/changes.html#v0-5-0
See release notes: http://patsy.readthedocs.org/en/latest/changes.html#v0-5-0
Dropped support for Python 2.6 and 3.3.
Update to keep up with pandas API changes
More consistent handling of degenerate linear constraints in DesignInfo.linear_constraint() ( #89 )
Fix a crash in DesignMatrix.repr when shape[0] == 0
Fix deprecation warnings encountered with numpy 1.10
New features:
Bug fixes:
Accept long as a valid integer type in the new DesignInfo classes. In particular this fixes errors that arise on 64-bit Windows builds (where ndarray.shape contains long objects), like ValueError: For numerical factors, num_columns must be an int.
Fix deprecation warnings encountered with numpy 1.10
…continue to work; however, these attributes are deprecated.
Incompatible changes:
EvalFactor and ModelDesc.from_formula() no longer take an eval_env argument.
The design_matrix_builders() function and the factor_protocol.memorize_passes_needed() method now require an eval_env as an additional argument.
The DesignInfo constructor’s arguments have totally changed. In addition to the changes needed to support the new features below, we no longer support “shim” DesignInfo objects that have non-trivial term specifications. This was only included in the first place to provide a compatibility hook for competing formula libraries; four years later, no such libraries have shown up. If one does, we can re-add it, but I’m not going to bother maintaining it in the mean time…
Dropped support for Python 3.2.
Other changes:
Patsy now supports Pandas’s new (version 0.15 or later) categorical objects.
Formulas (or more precisely, EvalFactor objects) now only keep a reference to the variables required from their environment instead of the whole environment where the formula was defined. (Thanks to Christian Hudon.)
DesignInfo has new attributes DesignInfo.factor_infos and DesignInfo.term_codings which provide detailed metadata about how each factor and term is encoded.
As a result of the above changes, the split between DesignInfo and DesignMatrixBuilder is no longer necessary; DesignMatrixBuiler has been eliminated. So for example, design_matrix_builders() now returns a list of DesignInfo objects, and you can now pass DesignInfo objects directly to any function for building design matrices. For compatibility, DesignInfo continues to provide .builder and .design_info attributes, so that old code should continue to work; however, these attributes are deprecated.
Ensured that attempting to pickle most Patsy objects raises an error. This has never been supported, and the interesting cases failed in any case, but now we’re taking a more systematic approach. (Soon we will add real, supported pickling support.)
Fixed a bug when running under python -OO .
- New stateful transforms for computing natural and cylic cubic splines with constraints, and tensor spline bases with constraints. (Thanks to @broess
New stateful transforms for computing natural and cylic cubic splines with constraints, and tensor spline bases with constraints. (Thanks to @broessli and GDF Suez for contributing this code.)
Dropped support for Python 2.5 and earlier.
Switched to using a single source tree for both Python 2 and Python 3.
Added a fast-path to skip NA detection for inputs with boolean dtypes (thanks to Matt Davis for patch).
Incompatible change: Sometimes when building a design matrix for a formula that does not depend on the data in any way, like "1 ~ 1" , we have no way to determine how many rows the resulting matrix should have. In previous versions of patsy, when this occurred we simply returned a matrix with 1 row. In 0.3.0+, we instead refuse to guess, and raise an error.
Note that because of the next change listed, this situation occurs less frequently in 0.3.0 than in previous versions.
If the data argument to build_design_matrices() (or derived functions like dmatrix() , dmatrices() ) is a pandas.DataFrame , then we now check its number of rows and index, and insist that the output design matrices match. This also means that if data is a DataFrame, then the error described in the first bullet above cannot occur – we will simply return a column of 1s that is the same size as the input dataframe.
Worked around some more limitations in py2exe/py2app and friends.
Fixed a nasty bug in missing value handling where, if missing values were present, dmatrix(..., result_type="dataframe") would always crash, and dmatr
Fixed a nasty bug in missing value handling where, if missing values were present, dmatrix(..., result_type="dataframe") would always crash, and dmatrices("y ~ 1") would produce left- and right-hand side matrices that had different numbers of rows. (As far as I can tell, this bug could not possibly cause incorrect results, only crashes, since it always involved the creation of matrices with incommensurate shapes. Therefore there is no need to worry about the accuracy of any analyses that were successfully performed with v0.2.0.)
Modified patsy/init.py to work around limitations in py2exe/py2app/etc.
The lowest officially supported Python version is now 2.5. So far as I know everything still works with Python 2.4, but as everyone else has continued
Warnings:
New features:
New support for automatically detecting and (optionally) removing missing values (see NAAction ).
New stateful transform for B-spline regression: bs() . (Requires scipy.)
Added a core API to make it possible to run predictions on only a subset of model terms. (This is particularly useful for e.g. plotting the isolated effect of a single fitted spline term.) See DesignMatrixBuilder.subset() .
LookupFactor now allows users to mark variables as categorical directly.
pandas.Categorical objects are now recognized as representing categorical data and handled appropriately.
Better error reporting for exceptions raised by user code inside formulas. We now, whenever possible, tag the generated exception with information about which factor’s code raised it, and use this information to give better error reporting.
EvalEnvironment.capture() now takes a reference argument, to make it easier to implement new dmatrix() -like functions.
Other: miscellaneous doc improvements and bug fixes.
First public release.
First public release.
Your coding agent can read these notes before it upgrades. Set up the MCP server →