What is Exploratory Data Analysis (EDA)?
Learn what EDA is, why it comes before modeling, and how to use pandas and visualizations to spot outliers, missing data, and relationships in a dataset.
Expected Interview Answer
Exploratory Data Analysis (EDA) is the process of summarizing and visualizing a dataset before modeling it, using descriptive statistics, plots, and correlation checks to understand distributions, spot outliers and missing data, and form hypotheses about relationships.
EDA typically moves from univariate analysis (examining one variable's distribution with histograms, boxplots, and summary statistics) to bivariate and multivariate analysis (scatterplots, correlation matrices, and grouped comparisons). Tools like pandas' describe() method, seaborn's histplot or pairplot, and correlation heatmaps make this fast in Python. Doing EDA well surfaces data quality problems, like missing values or impossible entries, before they silently corrupt a model, and it guides feature engineering by revealing which variables actually relate to the target. Skipping EDA is one of the most common reasons models underperform or behave unexpectedly in production.
- Catches data quality issues before they corrupt a model
- Reveals which variables actually relate to the target
- Guides feature engineering and model choice
- Surfaces outliers and missing data early
- Builds intuition about the dataset before any modeling
AI Mentor Explanation
EDA is like a coach walking the pitch and studying recent scorecards before picking a strategy, rather than guessing blind. You check batting averages for outliers, scan for missing scores due to rain-outs, and plot run rates against overs to see patterns before deciding on a game plan.
Step-by-Step Explanation
Step 1
Inspect structure
Check shape, data types, and a sample of rows to understand what you're working with.
Step 2
Summarize statistics
Use descriptive stats (mean, median, std, quartiles) to understand each variable's distribution.
Step 3
Check missing and duplicate data
Identify missing values, duplicates, and inconsistent categories that need cleaning.
Step 4
Visualize distributions
Plot histograms, boxplots, and bar charts to spot skew and outliers per variable.
Step 5
Explore relationships
Use scatterplots and correlation heatmaps to see how variables relate to each other and the target.
Step 6
Form hypotheses
Note patterns worth testing formally or feeding into feature engineering.
What Interviewer Expects
- Names concrete techniques: describe(), histograms, boxplots, correlation matrix
- Explains why EDA precedes modeling
- Mentions handling missing values and outliers
- Distinguishes univariate from bivariate/multivariate analysis
- Gives an example of an insight EDA can surface
Common Mistakes
- Skipping EDA and jumping straight to modeling
- Only computing summary statistics without visualizing the data
- Not checking for missing or duplicate data before analysis
- Confusing EDA with formal hypothesis testing
- Removing outliers automatically without investigating why they exist
Best Answer (HR Friendly)
“EDA is the first step in a data project where you explore and visualize the data before doing any modeling. It helps you spot mistakes, missing information, and interesting patterns early, so you don't build predictions on flawed data.”
Code Example
import pandas as pd
import seaborn as sns
df = pd.read_csv("customers.csv")
print(df.info())
print(df.describe())
print(df.isna().sum())
sns.histplot(df["monthly_spend"], kde=True)
sns.heatmap(df.corr(numeric_only=True), annot=True, cmap="coolwarm")Follow-up Questions
- What tools or libraries do you use for EDA in Python?
- How do you decide whether an outlier should be removed or kept?
- What is the difference between univariate and multivariate EDA?
- How does EDA inform feature engineering?
- How would you handle missing data discovered during EDA?
MCQ Practice
1. What is the main purpose of EDA?
EDA is about understanding the data's structure, quality, and relationships before any modeling begins.
2. Which of these is a typical EDA technique?
A correlation heatmap is a standard EDA visualization for spotting relationships between numeric variables.
3. Why check for missing data during EDA?
Unhandled missing data can silently bias a model, so EDA is where you decide how to address it.
Flash Cards
What does EDA stand for? — Exploratory Data Analysis.
Name two visualization types common in EDA. — Histograms and boxplots (also scatterplots and correlation heatmaps).
Why do EDA before modeling? — To catch data quality issues and understand relationships that shape feature engineering and model choice.
What pandas method gives quick summary statistics? — DataFrame.describe().