Python Charts
    • Matplotlib 63 The core library, with full control over every element
    • Plotly 27 Interactive charts for the web and notebooks
    • Seaborn 17 Statistical plots straight from DataFrames
    • Pandas 8 Quick charts with df.plot()
    • Altair 5 Declarative charts built on Vega-Lite
    • Plotnine 3 ggplot2's grammar of graphics in Python
    • Streamlit 1 Charts inside Streamlit data apps
    • A/B Testing 15 Sample size, analysis and sequential tests
    • Machine Learning 14 Evaluate and explain scikit-learn models
    • Causal Inference 10 Diff-in-diff, synthetic control, IV and more
    • AI 1 Use LLMs to build charts from your data
  • Python
  • All Posts
  • Event Study Plot in Python for Staggered Difference-in-Differences
    Causal Inference

    Event Study Plot in Python for Staggered Difference-in-Differences

    Build an event-study plot for a staggered rollout in Python, see why a two-way fixed effects regression gives distorted leads and lags, and fix it with clean never-treated comparisons.

    Nov 25, 2026
    causal inference difference in differences event study staggered adoption two-way fixed effects parallel trends statsmodels
  • Instrumental Variables in Python: 2SLS with linearmodels
    Causal Inference

    Instrumental Variables in Python: 2SLS with linearmodels

    Estimate a causal effect when a confounder you can't measure biases OLS, using an instrument and two-stage least squares in Python with linearmodels IV2SLS.

    Nov 25, 2026
    causal inference instrumental variables 2sls linearmodels endogeneity confounding weak instruments
  • Causal Inference in Python: How to Choose a Method
    Causal Inference

    Causal Inference in Python: How to Choose a Method

    A decision tree for picking a causal inference method in Python, with links to tutorials on difference-in-differences, synthetic control, regression discontinuity, interrupted time series and propensity scores.

    Nov 25, 2026
    causal inference difference in differences synthetic control regression discontinuity propensity score interrupted time series guide
  • Difference-in-Differences in Python: Parallel Trends Plot and Regression
    Causal Inference

    Difference-in-Differences in Python: Parallel Trends Plot and Regression

    Estimate a treatment effect with difference-in-differences in Python: plot parallel trends, run the regression in statsmodels, and draw an event-study chart.

    Nov 25, 2026
    difference-in-differences causal inference parallel trends event study statsmodels regression
  • Synthetic Control in Python: Build the Counterfactual and Run Placebo Tests
    Causal Inference

    Synthetic Control in Python: Build the Counterfactual and Run Placebo Tests

    Estimate the effect of a launch in one region by building a weighted blend of untouched regions that tracks it before the launch. Python code with SciPy, a gap plot, donor weights, and a placebo test.

    Nov 25, 2026
    causal inference synthetic control counterfactual scipy placebo test geo experiment panel data matplotlib
  • CausalImpact in Python: Estimate a Campaign's Effect with Structural Time Series
    Causal Inference

    CausalImpact in Python: Estimate a Campaign's Effect with Structural Time Series

    Estimate the effect of a campaign with no randomized control using a CausalImpact-style model in Python: a structural time series fit on the pre-period with control series, then forecast forward as the counterfactual.

    Nov 25, 2026
    causal inference causalimpact structural time series counterfactual campaign measurement placebo test statsmodels time series
  • Double Machine Learning in Python with DoubleML
    Causal Inference

    Double Machine Learning in Python with DoubleML

    Estimate a treatment effect from observational data with the DoubleML package, understand partialling out and cross-fitting by building it by hand, and see when flexible controls beat linear regression.

    Nov 25, 2026
    causal inference double machine learning doubleml confounding cross-fitting random forest observational data scikit-learn
  • Propensity Score Matching and IPW in Python (with a Love Plot)
    Causal Inference

    Propensity Score Matching and IPW in Python (with a Love Plot)

    Estimate a treatment effect from observational data in Python with propensity scores: fit them with scikit-learn, reweight with IPW, match on them, and check covariate balance with a love plot.

    Nov 25, 2026
    causal inference propensity score matching ipw observational data covariate balance scikit-learn statsmodels
  • Regression Discontinuity in Python: RD Plot and Local Linear Estimate
    Causal Inference

    Regression Discontinuity in Python: RD Plot and Local Linear Estimate

    Estimate a treatment effect at a cutoff in Python with regression discontinuity: draw the RD plot, fit a local linear model with statsmodels, and check bandwidth sensitivity, density, and placebo cutoffs.

    Nov 25, 2026
    causal inference regression discontinuity rdd statsmodels observational data bandwidth matplotlib
  • Interrupted Time Series in Python: Why Before/After Comparisons Mislead
    Causal Inference

    Interrupted Time Series in Python: Why Before/After Comparisons Mislead

    Measure the effect of a launch or policy change with no control group: see why a before/after comparison overstates it, then fit an interrupted time series in Python with statsmodels.

    Nov 25, 2026
    causal inference interrupted time series pre-post analysis segmented regression statsmodels time series counterfactual

Python plotting and visualization demystified

© 2026 PythonCharts.com. All rights reserved.
  • About
  • Credits
  • Privacy Policy