Skip to main content

drawing

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

  • Callaway & Sant'Anna's did
  • Sant'Anna and Zhao's DRDID

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)

Source distribution for differences 0.3.0
File Size Uploaded
differences-0.3.0.tar.gz 324.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for differences 0.3.0
File Interpreter ABI Platform
differences-0.3.0-py3-none-any.whl Python 3 none any Details

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 log

Release 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 log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page