Causal inference that refuses to let you skip the skepticism
DoWhy treats causal inference as a four-step audit—model, identify, estimate, and refute—rather than a single magic estimator.

What it does
DoWhy is a Python library for causal reasoning: estimating treatment effects, quantifying influences, running counterfactuals, and attributing root causes. It forces you to state your assumptions as a causal graph up front, then walks you through identifying an estimand, estimating it, and finally trying to refute the result.
The interesting bit
Rather than forcing you to choose between graphical models and potential outcomes, it uses both: causal graphs and do-calculus for modeling and identification, then switches to potential-outcomes methods for estimation. Its most unusual feature is a refutation API that stress-tests any estimate with robustness checks—essentially, it builds skepticism into the workflow.
Key highlights
- Four-step workflow: model, identify, estimate, and refute.
- Effect estimation, mediation analysis, counterfactual generation, and root-cause attribution.
- Marries graphical causal models with potential-outcomes estimation, including EconML integration for conditional average treatment effects.
- Refutation and falsification API that tests assumptions behind any estimation method.
- Graphical causal model API models data-generation mechanisms at each node for point-wise counterfactuals.
Caveats
- Optional
pygraphvizdependencies for better graph rendering are explicitly flagged as potentially problematic on some platforms.
Verdict
Useful if you are moving from prediction to causal questions and want a framework that keeps your assumptions visible and testable. Less helpful if you expect the library to infer the causal graph for you automatically.
Frequently asked
- What is py-why/dowhy?
- DoWhy treats causal inference as a four-step audit—model, identify, estimate, and refute—rather than a single magic estimator.
- Is dowhy open source?
- Yes — py-why/dowhy is open source, released under the MIT license.
- What language is dowhy written in?
- py-why/dowhy is primarily written in Python.
- How popular is dowhy?
- py-why/dowhy has 8.2k stars on GitHub.
- Where can I find dowhy?
- py-why/dowhy is on GitHub at https://github.com/py-why/dowhy.