Exploratory Data Analysis: lesson 1 of 3
Exploratory Data Analysis
Exploratory Data Analysis: A Practical Framework
Use a practical, iterative framework to understand a dataset before drawing conclusions or modeling.
Concept
Exploratory Data Analysis (EDA) is the disciplined process of understanding a dataset, its quality, and its patterns before modeling or final reporting. It combines business questions, descriptive statistics, visual inspection, and careful checks of what each row and column actually means.
Why It Matters
A churn model trained before the data is understood can learn missing-value quirks, duplicate customers, or information created after churn occurred. EDA identifies these risks early and helps decide whether modeling is useful at all. Cleaning fixes known issues; EDA discovers and interprets them. Final reporting communicates validated findings; EDA is the exploratory work that leads there.
Real-World Example
Consider a customer churn table with customer_id, age, tenure_months, contract_type, monthly_charges, total_charges, support_calls, region, and churn. Before asking why churn differs, confirm that a row represents one customer, that churn has a clear time window, and that total_charges was available before that outcome.
Practical Workflow
- Understand the business question and decision.
- Inspect dataset shape, columns, and row grain.
- Check data types and parsing issues.
- Measure missing values and their patterns.
- Check duplicate records and duplicate IDs.
- Summarize numerical columns.
- Inspect categorical values and proportions.
- Look at distributions and unusual ranges.
- Explore relationships and the target where relevant.
- Document findings, assumptions, and next checks.
EDA is iterative: a strange distribution can send you back to data types, source definitions, or duplicate checks.
Technical Checks
df.shape
df.info()
df.describe()
df.isna().sum()
df.duplicated().sum()
df["contract_type"].value_counts(dropna=False)
shape reports rows and columns; info() shows types and non-null counts; describe() summarizes numeric fields. These commands do not answer the business question by themselves. They identify where to look next. For example, total_charges stored as text cannot be summarized correctly until its values and conversion failures are understood.
Interpretation
If monthly charges have a high mean but lower median, spending may be right-skewed. If missing support-call values occur mostly in one region, missingness is itself a pattern worth investigating. If identical customer IDs occur repeatedly, determine whether they represent legitimate history or duplicate snapshots before dropping anything.
Failure Signals
Common Mistakes
- Starting model training before checking the target and row grain.
- Treating every missing value as a deletion task.
- Inspecting only averages and ignoring categories or distributions.
- Making charts without an analytical question.
- Treating a checklist as a one-pass process.
Best Practices
Write down the population, time period, target definition, and exclusions. Compare summaries with charts and domain context. Keep a small EDA log of observations, open questions, and actions; this makes later analysis reproducible and prevents a plausible guess from becoming an undocumented assumption.
Data Science Perspective
EDA connects Pandas, statistics, and visualization. A common workflow is raw extract -> EDA and cleaning -> analytical dataset -> visualization or modeling. Teams divide this work differently, but the need to understand data before using it is universal.
Interview Perspective
Question: How would you approach EDA on a new dataset? Answer: begin with the business objective and data grain, then inspect structure, quality, distributions, categories, relationships, and assumptions iteratively. Follow-up: explain what you would check before modeling churn.
Practice Questions
- Why should you inspect
customer_idduplicates before analyzing churn rate? - What might you investigate if
total_chargeshas an object dtype? - Write Pandas code to count missing values by column.
Quick Quiz
- Is EDA the same as final reporting? Answer: no; it is exploratory and iterative.
- What should define the meaning of a row? Answer: its data grain.
- Should missing values always be removed? Answer: no.
The First Fifteen Minutes
On a new churn dataset, first write the business question and prediction or reporting time window. Then identify the unit of observation: one row per customer, monthly customer snapshot, or support interaction? A million rows with only fifty unique customers may be legitimate history, but it may also mean duplicate exports or repeated snapshots. Next inspect shape, columns, dtypes, missingness, duplicates, numerical summaries, categorical frequencies, and target balance. End the first pass by writing questions discovered during inspection, such as why a category is missing or whether churn is rare enough to require careful evaluation.
Schema inspection is more than housekeeping. A numeric-looking total_charges stored as text, dates parsed inconsistently, or a target with only one class can invalidate later analysis. Missingness should be compared across groups: a missing value concentrated among churned customers could reflect process behavior rather than random absence. EDA loops back whenever an answer creates a new question.
Key Takeaway
Key Takeaways
EDA is structured curiosity: understand the question, validate the data, inspect patterns, and document what the evidence supports before modeling or presenting conclusions.
Next Lesson
Next, analyze single variables and relationships between pairs of variables.
Finish this lesson on your terms
Mark it complete when you have worked through the material and are ready to move on.