Summary and Setup
Hands-on spatial analysis with Python in Jupyter notebooks (Google Colab), using U.S. Census data as a case study: Python basics, getting ACS data through the Census API, cleaning it with pandas, and mapping it with GeoPandas.
This module was taught as part of the Purdue-NSF GIS Cybertraining for the Social Sciences Workshop, a two-day workshop held at Purdue University in 2026 (Day 1, Session B Python track). See the Workshop 2026 page for the full program.
It is part of Enabling the Geospatial Turn in the Social Sciences, a set of training modules developed at Purdue University with support from the National Science Foundation.
Workshop Overview
This workshop introduces Jupyter Notebook as a platform for data analysis using U.S. Census data as a practical case study. Participants will learn how to access, clean, analyze, and visualize data while understanding key Census concepts such as variables and geographic units.
Designed for beginners, the session emphasizes hands-on learning and guides participants through a complete workflow, from data acquisition to interpretation. No prior Python experience is needed, although some familiarity helps.
Schedule
| Time | Session | Content | Activities |
|---|---|---|---|
| 8:30 to 10:30 | Breakfast Introductions | - | - |
| 10:30 to 12:30 | Python Notebook Introduction | Jupyter Notebook, Google Colab and the core Python libraries | Open notebook, run first code cell, create markdown notes. Use libraries, create variables, load sample data, include short exercise on how to play with data |
| 12:30 to 1:15 | Lunch Break | - | - |
| 1:15 to 2:45 | Acquiring and Exploring Census Data | ACS vs. Decennial Census; ways of accessing data, including the Census API | Retrieve data, convert to DataFrame, Explore dataset structure, variables, tables, columns, and geographical units |
| 2:45 to 3:00 | Coffee Break | - | - |
| 3:00 to 4:30 | Census Data Analysis with Python | Cleaning the data, then charts and maps of population patterns | Maps/Charts of population distribution, interpreting results |
| 4:30 to 5:00 | Group Discussion | - | - |
Setup Requirements
We offer two setup paths:
- Google Colab: recommended for beginners; no installation needed
- Local installation with Anaconda Navigator: for offline work and full control
Option 1: Google Colab (Zero Installation, Recommended)
Google Colab is a free, cloud-based Jupyter notebook environment hosted by Google. It runs entirely in your browser, requires only a Google account, and comes with pandas, matplotlib, seaborn, and many other data science libraries pre-installed.
Steps
- Go to https://colab.research.google.com
- Sign in with your Google account (or create one if needed).
- Click New notebook (or File → New notebook).
-
(Optional) Rename it: File → Rename (e.g.,
Test_Notebook_YourName). - Test the libraries by running this in the first cell
(
Shift+Enterto execute):
PYTHON
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
print("pandas version:", pd.__version__)
print("matplotlib version:", plt.matplotlib.__version__)
print("seaborn version:", sns.__version__)
## Quick test plot (should appear inline)
tips = sns.load_dataset("tips") # built-in Seaborn dataset
sns.histplot(data=tips, x="total_bill", hue="time")
plt.title("Test: Restaurant Tips Distribution")
plt.show()
- If a package is missing or needs updating, install it with:
The
!prefix runs shell commands inside a Colab or Jupyter cell.
Advantages of Colab for this workshop
- No software installation required
- Free GPU/TPU access if needed later
- Easy sharing via File → Share
- Autosaves to Google Drive
- Perfect for following along with instructor demos
Tip: Upload your own data files using the left sidebar (Files → Upload), or mount Google Drive:
PYTHON
from google.colab import drive
drive.mount('/content/drive')
# Then read files like:
# pd.read_csv('/content/drive/MyDrive/penguins.csv')
Option 2: Local Installation (Anaconda Navigator)
Use this option if you prefer working offline or need a persistent local environment.
-
Download and install Anaconda Navigator:
- https://www.anaconda.com/products/navigator
- Choose your OS installer (Python 3.x version) and follow the default prompts.
After installation, launch Jupyter Notebook from the Anaconda Navigator home screen.
To install any missing packages, add the following to a code cell and run it:
Troubleshooting
| Problem | Fix |
|---|---|
| Colab: plots not showing | Add %matplotlib inline at the top of the notebook
(usually automatic) |
Local: ModuleNotFoundError
|
Run !pip install <package-name> in a code
cell |
| General help | Raise your hand during the workshop |