Abstract
Diff Diff is an open-source Digital Marketing & SEO project. Difference-in-Differences causal inference in Python. Callaway-Sant'Anna, Synthetic DiD, Honest DiD, event studies. sklearn-like API, validated against R. A Python library for Difference-in-Differences (DiD) causal inference - sklearn-like estimators with statsmodels-style outputs, built for econometricians, marketing analysts, and data scientists running campaign-lift, policy, and staggered-rollout analyses. It is built using Python. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building a Digital Marketing & SEO mini project or final-year project.
1. Introduction
A Python library for Difference-in-Differences (DiD) causal inference - sklearn-like estimators with statsmodels-style outputs, built for econometricians, marketing analysts, and data scientists running campaign-lift, policy, and staggered-rollout analyses.
2. Objective
Difference-in-Differences causal inference in Python. Callaway-Sant'Anna, Synthetic DiD, Honest DiD, event studies. sklearn-like API, validated against R.
This project demonstrates how Python can be applied to a real-world Digital Marketing & SEO problem.
4. Technology Stack
5. System Requirements
General requirements for this technology stack — check the README for exact versions.
- Python 3.8 or later
- pip / virtualenv for dependencies
- VS Code, PyCharm or Jupyter Notebook
- Git (to clone the repository)
6. Installation & Setup
git clone https://github.com/igerber/diff-diff.git
cd diff-diffpip install diff-diffgit clone https://github.com/igerber/diff-diff.git
cd diff-diff
pip install -e ".[dev]"import pandas as pd
from diff_diff import DifferenceInDifferences # or: DiD
data = pd.DataFrame({
'outcome': [10, 11, 15, 18, 9, 10, 12, 13],
'treated': [1, 1, 1, 1, 0, 0, 0, 0],
'post': [0, 0, 1, 1, 0, 0, 1, 1],
})
did = DifferenceInDifferences()
results = did.fit(data, outcome='outcome', treatment='treated', post='post')
print(results) # DiDResults(ATT=3.0000, SE=1.7321, p=0.1583)
results.print_summary() # full statsmodels-style tableFull setup instructions are in the project README.
7. Future Enhancements
Suggested extensions you can add to make this your own project.
- Export reports to Google Sheets or PDF
- Schedule weekly automated reports
- Add competitor comparison
8. Viva / Review Questions
Common questions examiners ask for projects in this domain.
- Which marketing or SEO problem does this tool solve?
- Which data sources or APIs does it use (Search Console, Analytics, social platforms)?
- Which metrics or KPIs does it report and how are they calculated?
- How could the output help a business make decisions?
- How would you schedule it to run automatically?
9. Source Code & License
This project is developed by igerber and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.
Want to build this as your internship project?
Work on a Digital Marketing & SEO project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.
Apply for Digital Marketing & SEO Internship