causallib
A Python package for flexible and modular causal inference modeling
Decision gist · record as of 2026-08-14
Yes. Causallib is actively maintained, has no known vulnerabilities, and offers a well-designed, modular approach to causal inference that will appeal to researchers and practitioners working with observational data. The fit-and-predict API and support for arbitrary ML models make it flexible and integrable into existing workflows. Install it if you need to estimate treatment effects from non-experimental data.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a machine learning model with sklearn-like fit-predict API; some causal models may require predict_proba implementation.
- Low friction install with a pure-Python wheel and a stable, actively maintained codebase.
- The package depends on common scientific libraries (pandas, scipy, numpy, matplotlib, statsmodels, networkx, dataclasses) that are widely available.
License · maintenance · safety
Apache License 2.0 (permissive) — Apache License 2.0 is permissive, allowing commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes, but there is no copyleft requirement.
last release 2025-04-06 (495 days) · last repo commit 2026-05-26 · 833 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,654,498 downloads/mo, #2,957 on PyPI
Alternatives
Verify before relying
pip install causallib
from causallib.estimation import IPW
from causallib.datasets import load_nhefs
data = load_nhefs()
ipw = IPW(model)
ipw.fit(data.X, data.a)
potential_outcomes = ipw.estimate_population_outcome(data.X, data.a, data.y)
effect = ipw.estimate_effect(potential_outcomes[1], potential_outcomes[0])- Whether the package supports Python versions beyond 3.9 (classifiers list 3.6–3.9 but requires_python is unspecified)
- Whether all causal models require predict_proba or only some (documentation mentions 'some models might require' it)
- Performance characteristics and scalability limits for large datasets
What it is and what it does
Causallib is a Python library for estimating causal effects from observational (non-experimental) data. It provides a suite of causal inference methods—weight-based models like IPW and direct outcome models like Standardization—all under a unified fit-and-predict interface. You supply your own machine learning model to handle internal prediction tasks, then use causallib's methods to estimate potential outcomes and treatment effects.
The package is designed around the potential outcomes framework: it separates potential-outcome prediction from effect estimation, which allows flexible specification of stratified effects and supports multi-treatment scenarios. It includes an evaluation suite that reinterprets standard ML diagnostics from a causal perspective, helping identify when internal models underperform. The out-of-bag fit-and-predict workflow supports honest effect estimation by training on one set of examples and evaluating on another.
Use it for
- Estimate average treatment effect (ATE) or treatment effect on the treated (ATT) from observational health or social science data.
- Build conditional average treatment effect (CATE) models to predict individual-level causal effects using direct outcome methods.
- Diagnose and debug causal models by applying ML evaluation metrics through a causal lens to identify model misspecification.
- Chain causal inference with preprocessing pipelines to filter rows and select confounders before effect estimation.
- Compare multiple causal inference strategies (IPW vs. Standardization) on the same data under a unified API.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Causallib is actively maintained, has no known vulnerabilities, and offers a well-designed, modular approach to causal inference that will appeal to researchers and practitioners working with observational data. The fit-and-predict API and support for arbitrary ML models make it flexible and integrable into existing workflows. Install it if you need to estimate treatment effects from non-experimental data.
Install
causallib on PyPI
Before you install
Low friction install with a pure-Python wheel and a stable, actively maintained codebase. The package depends on common scientific libraries (pandas, scipy, numpy, matplotlib, statsmodels, networkx, dataclasses) that are widely available.
Requires a machine learning model with sklearn-like fit-predict API; some causal models may require predict_proba implementation.
License in practice
Apache License 2.0 is permissive, allowing commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes, but there is no copyleft requirement.
Quickstart
pip install causallib
from causallib.estimation import IPW
from causallib.datasets import load_nhefs
data = load_nhefs()
ipw = IPW(model)
ipw.fit(data.X, data.a)
potential_outcomes = ipw.estimate_population_outcome(data.X, data.a, data.y)
effect = ipw.estimate_effect(potential_outcomes[1], potential_outcomes[0])
Verify before relying
- Whether the package supports Python versions beyond 3.9 (classifiers list 3.6–3.9 but requires_python is unspecified)
- Whether all causal models require predict_proba or only some (documentation mentions 'some models might require' it)
- Performance characteristics and scalability limits for large datasets
Package facts
| License | Apache License 2.0 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 8 packagespandasscipystatsmodelsnetworkxnumpyscikit-learnmatplotlibdataclasses |
| Maintenance | Actively maintained 495 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,654,498 / month, #2,957 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering |
Evidence: causallib-0.10.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “causal inference observational data”
- causallibCausallib estimates causal effects from observational data using a…
- cemImplements Coarsened Exact Matching (CEM), a statistical matching…
- causalmlCausalml estimates the causal impact of treatments on outcomes at the…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also causalml · dowhy · psmpy · empirical-calibration · econml · pgmpy · cem · pyfixest