Day 67 Β· Interviewing your data

Exploratory Data Analysis

You will be able to
  • Run a repeatable EDA checklist: shape, types, missingness, distributions, relationships, time, leakage
  • Choose the right plot (histogram, scatter, box) and read skew, outliers, and separation from it
  • Quantify relationships with correlations and grouped target rates β€” and state their limits
  • Detect target leakage by interrogating any feature that looks too good
  • Write findings as defensible sentences with numbers, not as chart dumps
Today's ~120 minutes
Spaced-rep warm-up: Days 65–66 cards (selection, joins, groupby)10 min
ELI5 + tech read: the interview checklist & leakage20 min
Guided: first interview + signal-and-leak hunt42 min
Practice: five findings, five sentences20 min
Project: eda_checklist.md with worked example18 min
Quiz + flashcards10 min

Builds on: Day 65 β€” DataFrames & selection Β· Day 66 β€” groupby, merge & reshape Β· Day 58 β€” Distributions, skew & heavy tails

The analogy

A journalist handed a press release does not print it β€” they interview. Who are you? (shape, columns, types.) Where are the gaps in your story? (missing values.) Walk me through a typical day β€” and your worst day. (distributions, outliers.) Who are you connected to? (correlations.) And the question that breaks cases open: how do you know that β€” did you learn it BEFORE or AFTER the fact? That last one is leakage hunting: a column that "predicts" churn perfectly usually turns out to be a consequence of churn, quietly written back into the file after the customer left. It aces the interview because it already read tomorrow's newspaper.

EDA is that interview, done in pandas and plots, BEFORE any model touches the data. The order matters: understand each character alone (univariate), then the relationships (bivariate), then the timeline. And the output is not a pile of charts β€” it is findings written as sentences a skeptic can check: "Customers with 3+ support tickets churn at 41% vs 12% baseline (n = 214)." A chart is evidence; the sentence is the testimony.

Why this matters on the job

Skipping EDA is how teams spend three weeks tuning a model on data with a leak, a unit mix-up, or 30% silent missingness β€” then watch the "95% accurate" model collapse in production. Day 70's checkpoint IS an EDA report; Day 77's competition and Day 83's churn project begin with this checklist; Day 80's error analysis is EDA pointed at model mistakes. For an FDE, the first customer dataset is a first interview β€” the engineer who finds the data's three surprises in an afternoon earns the room's trust before any model exists.

Guided practice

guided 1

The first interview β€” identity, gaps, shapes

20 min
  1. Paste the starter β€” a seeded 1,200-customer churn dataset with three planted surprises you have not been told about.
  2. Identity pass: shape, dtypes, head. One column that should be numeric is an object β€” find it (a sentinel string is hiding in it) and fix with pd.to_numeric(col, errors="coerce").
  3. Gaps pass: df.isna().mean().sort_values(ascending=False) β€” which columns leak data and how much? Is missingness random, or concentrated in one plan tier? (Check with a groupby β€” this distinction drives Day 68's strategy.)
  4. Univariate pass: histogram monthly_spend β€” heavily right-skewed, so re-plot on log scale and note how the story changes. value_counts on plan and region.
  5. Outlier pass: box plot tenure_months by plan; quantiles of spend at [0.01, 0.5, 0.99]. Decide for each extreme: error or whale?
  6. Write your first two findings as sentences with numbers and denominators.
🐍 python β€” editable, runs in your browser
Ctrl/⌘+Enter runs · Tab indents · numpy/pandas/sklearn auto-load on import (torch and network calls need a local run)
guided 2

Find the signal β€” and smell the leak

22 min
  1. Overall churn rate first β€” the baseline every comparison needs: df.churned.mean() (~30%).
  2. Grouped target rates, the EDA workhorse: churn by plan, churn by tenure bins (pd.cut(df.tenure_months, bins=[0, 12, 24, 48, 60])), churn by ticket count (0, 1, 2, 3+). Two real signals should emerge: churn falls with tenure and rises with tickets.
  3. Correlation matrix on numerics + churned (as int). Rank features by |r| with churn.
  4. One feature will dominate at r β‰ˆ 0.8+: refund_issued. Interrogate it: churn rate among refund receivers vs not (~92% vs ~3%). This separation is TOO clean for a real pre-churn signal.
  5. Ask the journalist's question: is a refund issued before or after a customer decides to leave? After. It is a consequence of churn, not a predictor β€” a LEAK. Write the finding: "refund_issued separates churn almost perfectly (r β‰ˆ 0.85) but is generated post-outcome; it must be excluded from any model."
  6. Check csat honestly: with 40% missing in the basic tier, a naive "csat vs churn" comparison is biased by WHO is missing. Note it for Day 68 rather than hand-waving it today.
  7. Scatter tenure vs spend colored by churn β€” confirm there is no magic pattern hiding, and say why the boring result is still a finding ("no interaction visible between tenure and spend").
🐍 python β€” editable, runs in your browser
Ctrl/⌘+Enter runs · Tab indents · numpy/pandas/sklearn auto-load on import (torch and network calls need a local run)

On your own

Five findings, five sentences

20 min

Deliver the interview transcript: five findings from the churn dataset, each a single sentence in the claim + number + denominator + comparison format, each backed by one named piece of evidence (a groupby result or plot you can reproduce).

Constraints: at least one finding about data QUALITY (the sentinel column or the biased missingness), at least one about the LEAK (with the exclusion recommendation), at least one genuine predictive signal with its effect size (e.g. churn at 3+ tickets vs baseline), and at least one honest negative ("monthly_spend shows no meaningful association with churn, r = …") β€” absence of signal is information someone was going to waste a week on.

Then rank the five by "what a stakeholder must hear first" and justify the top pick in one line. Hints: lead with what changes decisions (the leak β€” it invalidates any model trained naively on this file); n and denominators make claims defensible; round numbers to the precision the sample size supports (Day 60: n = 214 does not justify "41.3%").

Ship before you stop

eda_checklist.md β€” your reusable interview script

Turn today into an artifact you will reuse at least four times (Days 70, 77, 80, 83). Write eda_checklist.md in your practice repo: the seven interview stages, each with the exact pandas one-liners, what to look for, and a "red flags" line (sentinels, spikes at zero, alphabetical date sorts, too-clean separations). Include the finding-sentence template and a short "leakage interrogation" section with the three questions to ask any suspiciously strong feature (When is this value created? Could it exist at prediction time? Does it survive a time-ordered split?). Then prove the checklist works: run it top to bottom against today's churn dataset and append the resulting five findings as the worked example. Commit both.

Rubric β€” check what you completed (0/6)

Common mistakes & misconceptions

  • Modeling before interviewing. Every hour of EDA saves days of tuning a model on broken data β€” the leak in today's dataset would have produced a fake 95% accuracy.
  • Celebrating the too-good feature instead of interrogating it. Near-perfect separation is a leakage alarm, not a victory. Ask when the value is created.
  • Reading r = 0 as "no relationship". Correlation only sees linear patterns; plot the pair before dismissing it.
  • Using means on skewed columns. Day 58 again: spend and latency need medians and quantiles; one whale customer drags every mean.
  • Deleting outliers by reflex. A 250-year age is an error; a 10Γ— spend customer is your best account. Judge each, document the judgment.
  • Shipping charts without sentences. A figure without a claim, number, and denominator delegates the thinking to the reader β€” who will decline.
Knowledge check

Q1. A feature separates your churn target almost perfectly (r β‰ˆ 0.85). Your FIRST move is…

Q2. Pearson correlation between two variables is 0.02. What can you conclude?

Q3. csat is missing for 40% of basic-tier customers but almost never for enterprise. Comparing raw mean csat between churned and retained customers is…

Go deeper β€” curated resources

courseKaggle Learn β€” Data Visualization (interactive) β†—30 mindocspandas User Guide β€” visualization & statistical functions β†—20 mincourseGoogle ML Crash Course β€” working with data modules β†—25 min
If you have a third hour
  • Simpson's paradox β€” when aggregation reverses the truth β€” A relationship can hold in every subgroup and reverse in the total (the Berkeley admissions case). Ten minutes that will one day stop you from shipping a backwards conclusion.
Done means
  • All three planted surprises found (sentinel column, biased missingness, refund leak)
  • Grouped churn rates computed for plan, tenure bins, and ticket bins with the baseline stated
  • Five findings written in the sentence format, ranked, with one honest negative
  • eda_checklist.md committed with the worked example; quiz β‰₯ 2/3
How this connects

← Back: The skew you diagnosed is Day 58's heavy tails made visible; grouped target rates are Day 66's groupby doing inference work; and "the visible csat values are a biased spoonful" is Day 60's sampling-bias lesson in the wild.

Forward β†’: Day 68 acts on the gaps and sentinels you found; Day 69 turns the clean signals into features (and excludes the leak); Day 70's checkpoint is this interview written up for stakeholders. Day 80 re-aims the same checklist at model errors.

Unlocks: D68 Cleaning & Validation Β· D69 Feature Engineering Β· D70 Week 10 Checkpoint: EDA Report Β· D80 Error Analysis