"A chart is an argument about what deserves attention—and honest scales are part of that argument." — Paraphrasing stats and visualization educators
Duration: 7–9 hours · Difficulty: Intermediate · Prerequisites: Intro stats comfort; Python 3.10+ in a venv.
Learning Objectives
By the end of this module, you will be able to:
- Load, inspect, and clean CSV/Excel-style tables with pandas.
- Compute descriptive stats and group summaries appropriate to your domain.
- Visualize with matplotlib (optional seaborn) using honest scales and source notes.
- Use AI as a calculator assistant—you specify design and verify assumptions.
- Compare Excel, Python, and “full AI pipeline” workflows—and know where AI misleads on causality and joins.
Concept 1: Why Python + pandas
| Dimension | Excel | Python/pandas | AI assistant |
|---|---|---|---|
| First plot | Fast | Slower setup | Fast if schema clear |
| Reproducibility | Manual risk | Git + scripts | Weak unless you save code |
| Complex joins | Error-prone at scale | Explicit | May hallucinate columns |
| Stats | Toolpack / formulas | scipy/statsmodels | May pick wrong test |
Concept: Print df.shape after every merge—row-count surprises catch silent drops or explosions.
Messy data → first check
| Symptom | First check | Typical fix |
|---|---|---|
| Weird summaries | describe(include="all") | Coerce dtypes |
| Merge exploded | len before/after | Key duplicates |
| Empty chart | NA fraction | Filter or document imputation |
Concept 2: Question → Report
- Define question and unit of analysis (one row = ?). 2. Ingest with source + date. 3. Profile missingness, dtypes, dupes. 4. Transform with formulas in comments. 5. Analyze; visualize; report magnitude and limitations.
Associational trap: “Library hours vs GPA” ignores self-selection—frame as association, not cause, unless design supports more.
Pitfalls vs AI
| Pitfall | AI might tempt you to… |
|---|---|
| Confounding | Oversimple regression |
| p-hacking | Run many tests silently |
| Ecological fallacy | Confuse group and individual |
Concept 3: Visualization with AI
Sketch chart intent in chat; implement in your matplotlib. Checklist: meaningful zero baseline for counts; units on axes; n in caption; source line.
Environment Setup (plain instructions)
python -m venv .venv
,[object Object],
pip install pandas matplotlib openpyxlHands-On: Load and Profile
Key Example: This pattern is the spine of most course projects—everything else is filtering, grouping, and plotting.
[object Object], pandas ,[object Object], pd
df = pd.read_csv(,[object Object],)
,[object Object],(df.shape)
,[object Object],(df.columns.tolist())
,[object Object],(df.dtypes)
,[object Object],(df.isna().mean().sort_values(ascending=,[object Object],).head())In words: After read_csv, always check shape, dtypes, and missingness before plotting—otherwise charts lie because "12" is still a string. Group with groupby(...).agg(...), merge with explicit how= and row-count checks, plot with title, xlabel, ylabel, and savefig at 150–300 DPI when final.
Try This! Ask ChatGPT for pandas for your schema—then run head(), assert row counts, and grep column names against the real CSV header.
Fun Fact: Mean of ratios ≠ ratio of means—your caption should say which denominator you used.
Dashboards for coursework
A “dashboard” can be one figure with 2×2 panels: KPI text, distribution, breakdown by category, missingness bars—or a short HTML/PDF export from Jupyter/Quarto.
Presenting findings
Slides: Question → one clean figure → methods in five bullets → limitations → one “so what.” Executive summary: three numbers max with context for a non-technical reader.
Try This Now
- Data dictionary before any plot.
- Join lab — predict inner vs outer counts on toy CSVs.
- Misleading chart online → redraw ethically; two sentences on what changed.
Practice Exercises
Data dictionary; join sanity; misleading chart fix; aggregation puzzle (mean of ratios vs ratio of means); AI code review log with three verified flags.
Mini-Project
Notebook: ≥3 visualizations with magnitude-aware captions; methods 300–500 words (source, cleaning, bias); one-page executive summary; optional AI disclosure for code help.
Key Takeaways
- Reproducibility is kindness to graders and future you.
- Visualization is argument—axes and n matter.
- Statistics without design is storytelling—name bias early.
Key Takeaway
- Use Excel for speed, Python for repeatability, AI for boilerplate—you always verify joins and tests.
- Label charts with units, source, and sample definition; call out non-causal scatter plots honestly.
- Dtypes and missingness before pretty pictures—fix coercion first.
- Treat AI-suggested analyses as drafts until assumptions match your study design.
- Ship a limitations paragraph—mature projects own what the data cannot prove.
Resources
- pandas: https://pandas.pydata.org/docs/ · matplotlib gallery: https://matplotlib.org/stable/gallery/index.html
- Wilke, Fundamentals of Data Visualization — principles
Appendix: Sample public data sources
| Source | Note |
|---|---|
| data.gov | Check update frequency |
| Campus open data | Aggregate; FERPA norms |
| Kaggle | Cite honestly in coursework |
Record access date and license in methods.