A introduction to causal inference using common tools from the python data stack
You'll need graphviz
for our first exercise notebook, to visualize causal graphs.
- Linux:
- Depending on your distro, here are the possible commands
- MacOS:
- You can easily install it via homebrew:
brew install graphviz
- You can easily install it via homebrew:
- Windows:
- The graphviz.org website has convenient installers for you
In your terminal, use git
to clone the repo to your machine.
git clone [email protected]:ronikobrosly/pydata_nyc_2022.git
If you are less comfortable with git
, there is an easy alternative: You can simply download a zip file of it here :)
Now you'll need to ensure you have a working python environment set up.
This tutorial requires python version 3.9
for the notebook exercises to properly work.
Create a new virtual environment for this tutorial. You can do this a number of ways. If you are running Anaconda python, you can do this through the conda command. Another method is to use the virtualenv
python package. If you are a Windows or Linux user, please use this guide. If you are a MacOS user you can follow this guide.
Name your environment causal_modeling
"Activate" this environment (see the above guide) and then run the following command in the root folder of this repo:
pip install -r requirement.txt
This will install all the necessary packages for the tutorial.
As an optional step, you can try to run the check_environment.py
file (in the root folder of the repo)
while within your virtual environment. You can do so by running python check_environment.py
in your terminal. It will alert you if you're missing any required python packages.
Once the above is complete, you'll need to run the following commands:
python -m ipykernel install --user --name causal_modeling --display-name "Python (causal_modeling)"
In the terminal, execute jupyter lab
.
Navigate to the notebooks
directory and open your notebook of choice. You will probably be asked which environment you would like to use with the notebook. Select the Python (causal_modeling)
environment you created in the step above.
Slides to go along with the tutorial are available as a Google Doc Presentation.
I love would to hear your feedback on these tutorial materials! Please send your comments to [email protected].