difference-in-differences estimation and inference for Python
For the following use cases
- Balanced panels, unbalanced panels & repeated cross-section
- Two + Multiple time periods
- Fixed + Staggered treatment timing
- Binary + Multi-Valued treatment
- Heterogeneous treatment effects & triple difference
- Parallelized estimation & multiplier bootstrap (joblib, via
n_jobs)
see the Documentation for more details.
Installing
The latest release can be installed using pip
pip install differences
requires Python >= 3.10
Quick Start
ATTgt
the ATTgt class implements the estimation procedures suggested by Callaway and Sant'Anna (2021) , Sant'Anna and Zhao (2020) and the multi-valued treatment case discussed in Callaway, Goodman-Bacon & Sant'Anna (2021)
import differences
df = differences.generate_data() # requires the [all] extra: pip install differences[all]
att_gt = differences.ATTgt(data=df, cohort_column='cohort')
att_gt.fit(formula='y', n_jobs=-1)
att_gt.aggregate('event')
differences ATTgt was inspired by
Metadata
Release files for differences 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| differences-0.3.0.tar.gz | 324.2 kB | With provenance | Details for differences-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| differences-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for differences-0.3.0-py3-none-any.whl |
Total release size: 413.6 kB
Release files / differences-0.3.0.tar.gz
| Download URL | differences-0.3.0.tar.gz |
|---|---|
| Size | 324.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f0bf18908aac127a2ba93ca552f34a7a1d7e9433ea5dde0a0552e919579e980
|
|
BLAKE2b-256 checksum How to use checksums |
985f28ef330dbf0379e1416c685f327e96805a7f0f0069f67691d88ba5187e7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logRelease files / differences-0.3.0-py3-none-any.whl
| Download URL | differences-0.3.0-py3-none-any.whl |
|---|---|
| Size | 89.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06164a4ed52c55ba958ad8c9ef2081841f985ba12b9850985b08fded1ff10c82
|
|
BLAKE2b-256 checksum How to use checksums |
c0711e443377b27847eccf2dc1889893054f38d4b949d7ebe62a1d0270e4e674
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logSecurity for differences 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for differences-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.