econml
This package contains several methods for calculating Conditional Average Treatment Effects
What it is and what it does
EconML is a machine learning toolkit for causal inference that estimates heterogeneous treatment effects—how the causal impact of an intervention on an outcome varies across different groups or feature values. It combines econometric methods with modern ML techniques to work with observational (non-experimental) data, where you measure treatment T's effect on outcome Y while controlling for confounders X and W. The package provides a unified API across multiple estimation strategies, many of which return confidence intervals and statistical inference results.
The core use case is personalized decision-making: given a sample with particular features, what is the expected causal effect of applying a treatment to that sample? This is useful in policy learning, A/B testing analysis, and any domain where you need to understand not just average effects but how effects differ across populations. The package assumes either no unobserved confounders or access to instrumental variables, depending on the method chosen.
Use it for:
- Estimate how a marketing intervention's effect on customer spending varies by customer demographics or purchase history.
- Analyze clinical trial or observational medical data to determine which patient subgroups benefit most from a treatment.
- Evaluate policy interventions to identify which populations see the largest causal effects.
- Learn optimal treatment assignment policies by combining effect estimation with policy learning methods.
- Conduct causal model selection and cross-validation to choose among competing heterogeneous effect estimators.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
EconML estimates heterogeneous treatment effects from observational data using machine learning, measuring how causal effects of interventions vary across different sample characteristics.
Yes, if you need to estimate causal treatment effects from observational data and want flexibility in modeling effect heterogeneity. The package is actively maintained, well-documented, MIT-licensed, and has no known vulnerabilities. Install friction is moderate due to dependencies; ensure your environment can build numba and scipy. Not suitable if you only need average treatment effects or lack domain knowledge of causal assumptions.
Install
econml on PyPI
pip
pip install econmluv
uv add econmlpoetry
poetry add econmlInstalling econml
Before you install
Medium install friction due to 11 runtime dependencies including numpy, scipy, numba, and lightgbm. Active maintenance with recent release (14 days old) and strong repository signals (4753 stars, last commit 2026-08-11). Prebuilt wheels available for Python 3.9–3.14 across macOS, Linux, and Windows.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
pip install econml
from econml.dml import LinearDML
from econml.inference import BootstrapInference
est = LinearDML(model_y=LassoCV(), model_t=LassoCV())
est.fit(Y, T, X=X, W=W)
Requires Python ≥3.9; medium install friction due to compiled dependencies (numba, scipy, lightgbm) that may require build tools on some systems.
Verify before relying
- Whether the package supports GPU acceleration or distributed computation for large datasets.
- Performance characteristics and scalability limits for high-dimensional feature spaces.
- Specific causal assumptions required by each estimation method and how to validate them.
- Whether LassoCV is available as a built-in or requires external installation.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 11 — numpy, numba, scipy, scikit-learn, sparse, joblib, statsmodels, pandas, shap, lightgbm, packaging |
| Maintenance | actively maintained — 14 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 563,080/month — #5,982 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: econml-0.17.0-cp310-cp310-macosx_11_0_arm64.whl; econml-0.17.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; econml-0.17.0-cp310-cp310-win_amd64.whl; econml-0.17.0-cp311-cp311-macosx_11_0_arm64.whl; econml-0.17.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; econml-0.17.0-cp311-cp311-win_amd64.whl; econml-0.17.0-cp312-cp312-macosx_11_0_arm64.whl; econml-0.17.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; econml-0.17.0-cp312-cp312-win_amd64.whl; econml-0.17.0-cp313-cp313-macosx_11_0_arm64.whl; econml-0.17.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; econml-0.17.0-cp313-cp313-win_amd64.whl; econml-0.17.0-cp314-cp314-macosx_11_0_arm64.whl; econml-0.17.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; econml-0.17.0-cp314-cp314t-macosx_11_0_arm64.whl; econml-0.17.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; econml-0.17.0-cp314-cp314t-win_amd64.whl; econml-0.17.0-cp314-cp314-win_amd64.whl; econml-0.17.0-cp39-cp39-macosx_11_0_arm64.whl; econml-0.17.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Keywords: treatment-effect
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
causalmlCausalml estimates the causal impact of…
permissive · top 15,000 on PyPI
causallibCausallib estimates causal effects from…
permissive · top 5,000 on PyPI
cemImplements Coarsened Exact Matching (CEM), a…
unclear · top 5,000 on PyPI
pyfixestPyFixest performs fast high-dimensional fixed…
permissive · top 15,000 on PyPI
psmpyPsmPy implements propensity score matching for…
permissive · top 5,000 on PyPI
rdrobustImplements regression discontinuity (RD) design…
copyleft · top 15,000 on PyPI
dowhyDoWhy is a Python library for causal inference…
permissive · top 15,000 on PyPI
pyhdfePyHDFE absorbs high-dimensional fixed effects…
permissive · top 15,000 on PyPI
empirical-calibrationComputes empirical calibration weights to…
permissive · top 15,000 on PyPI
linearmodelsProvides panel regression, instrumental…
unclear · top 15,000 on PyPI