21. What is exploratory data analysis, and what should it establish before modeling or decision-making?
Define exploratory data analysis and describe a practical sequence for checking data grain, types, missingness, duplicates, distributions, outliers, relationships, segments, time patterns, and possible leakage. Explain which findings should become data-quality fixes, follow-up questions, hypotheses, visualizations, or constraints on later analysis.
EDA is how I understand and validate data before using it. I check the grain, types, missingness, duplicates, distributions, outliers, relationships, segments, time patterns, and leakage. It should reveal data-quality problems, useful patterns, open questions, testable hypotheses, helpful visualizations, and constraints for later analysis.
Exploratory data analysis, or EDA, is the first structured examination of a dataset before modeling or making a decision. Its purpose is not only to make charts. It should establish what one row represents, whether the values are usable, which patterns deserve investigation, and what risks could make later conclusions misleading. A practical EDA checks grain, types, missingness, duplicates, distributions, outliers, relationships, segments, time patterns, and leakage. Its findings then become data-quality fixes, follow-up questions, hypotheses, visualizations, or explicit constraints on later work.
- What does one row represent, and what is the intended unit of analysis?
- Which fields are expected to be unique identifiers, categories, dates, or numeric measures?
- Are there known data-quality issues, source-system changes, or periods with incomplete data?
- Is there a future outcome or decision this analysis may later support, so I can check carefully for leakage?
I would explain EDA as an ordered validation and learning process.
First, I check the data grain. Grain means what one row represents. In the diagram's order example, one row is intended to represent one order, and the stated time grain is day. I verify the business unit, time unit, identifiers, and whether different grains have accidentally been mixed. If the grain is wrong, later counts, averages, joins, and model labels can all be wrong.
Second, I inspect data types. I check whether numeric, text, date, Boolean, identifier, and categorical fields are stored as the intended types. An identifier stored as a number should usually not be treated as a continuous measurement. Dates stored as text may also need parsing before time analysis.
Third, I measure missingness. I count missing values and percentages by column and look for patterns rather than treating every missing value the same way. Missingness may indicate a collection problem, a field that is not applicable for some records, or a segment-specific issue. The reason for missingness determines whether I should repair the data, exclude records, represent missingness explicitly, or ask a follow-up question.
Fourth, I check duplicates. I look for exact duplicate rows, repeated business keys, and unintended repeated records. In the diagram's small order example, order_id 1002 appears twice with the same values, so I would investigate whether it is a true duplicate before aggregating orders. Duplicate records can inflate counts, sums, and frequencies.
Fifth, I study distributions. For numeric variables I inspect summary statistics such as mean, median, minimum, maximum, and standard deviation, together with histograms or similar plots. For categorical variables I examine value counts. This establishes typical values, spread, skew, rare categories, impossible values, and whether averages are representative.
Sixth, I investigate outliers. I can use simple rules such as the interquartile range or z-scores as flags, but I do not automatically delete flagged observations. I visualize them and compare them with data definitions or domain rules because an extreme value can be a data-entry error or a real, important event. In the diagram, an order amount of 5000 is treated as an outlier that should be investigated rather than silently removed.
Seventh, I examine relationships. For numeric variables I may inspect correlations and scatter plots. For categorical relationships I may use cross-tabs or grouped summaries. If a future target exists, I can compare candidate features with that target, but I keep correlation separate from causation. A strong relationship is a clue to investigate, not proof that changing one variable will cause the other to change.
Eighth, I analyze meaningful segments supported by the data, such as customer groups or countries when those fields exist. I compare behavior across segments and look for imbalance. Segment analysis can reveal that an overall pattern is driven by one subgroup, but very small segments can produce unstable conclusions.
Ninth, I inspect time patterns when timestamps or dates exist. I look for trends, seasonality, day-of-week or month effects, structural breaks, and unusual spikes. Time ordering matters because future information must not influence an analysis that is supposed to represent an earlier point in time.
Tenth, I check for leakage. Leakage means using information that would not legitimately be available when a later model or decision is made. I look for future information, post-outcome fields, or variables that are effectively proxies for the outcome. A leakage feature can make historical analysis or model evaluation look unrealistically strong.
After these checks, I summarize what EDA has established. I want to know whether the data is accurate enough, complete enough, consistent enough, and at the right grain for the intended analysis. I also want to know whether the dataset covers the relevant population, period, and scenarios; which important patterns and relationships appear; which segments behave differently; and which risks, limitations, anomalies, or possible leakage remain.
I then turn findings into specific actions. Confirmed data-quality problems become fixes such as correcting types, handling missing values, removing confirmed duplicates, correcting errors, standardizing categories, and aligning grain. Unclear definitions or unexplained patterns become follow-up questions. Plausible explanations become hypotheses to test rather than conclusions. Important distributions, relationships, segments, or time trends become visualizations. Known limitations become constraints on later work, such as removing leakage features, respecting time windows, handling imbalance, or choosing evaluation metrics that fit the problem.
Using the diagram's e-commerce example, I would first confirm that one row means one order. I would flag duplicate order_id 1002, investigate the missing amount, and examine the amount of 5000 as a possible outlier. The diagram also shows that most sample orders are from the US, states that orders peak on weekends, and reports no leakage columns found. The weekend pattern cannot be established from the five displayed rows alone, so I would treat it as a finding from a broader time analysis that still needs enough historical coverage to validate. These observations do not by themselves prove why order amount changes. The next step is to clean confirmed data problems, confirm definitions, and then investigate possible drivers with appropriate visualizations and hypotheses.
The main principle is that good EDA builds justified trust in the data. It reduces the chance of modeling a data error, explaining an artifact as a real pattern, or making a decision from information that would not actually be available.
- Define the observation grain: state exactly what one row represents, the relevant entities, and the time grain.
- Validate data types: identify numeric, categorical, text, date, Boolean, and identifier fields and find incorrect representations.
- Measure missingness: count missing values by field and inspect whether missingness follows a pattern.
- Check duplicates: detect exact duplicate rows and repeated business keys, then determine whether they are legitimate repeats.
- Examine distributions: calculate useful summaries and visualize numeric distributions; inspect categorical value counts.
- Investigate outliers: flag extreme observations, visualize them, and distinguish data errors from real events.
- Study relationships: inspect correlations, cross-tabs, scatter plots, and feature-to-target relationships when a target exists, without treating correlation as causation.
- Compare supported segments: look for different behavior and imbalance across meaningful groups.
- Inspect time patterns: check trends, seasonality, calendar effects, spikes, and structural breaks.
- Check leakage: identify future information, post-outcome fields, and target proxies that would not be available at the intended decision time.
- Classify findings: turn confirmed errors into data-quality fixes, uncertainty into follow-up questions, plausible explanations into hypotheses, useful patterns into visualizations, and known risks into constraints on later analysis.
- Reassess readiness: proceed only with a clear statement of what is trustworthy, what remains uncertain, and what limitations later modeling or decisions must respect.
EDA has no single fixed computational complexity because each check has a different cost. Basic summaries, missing-value counts, type checks, and duplicate scans are often roughly proportional to the number of rows and columns. Pairwise relationship checks can become much more expensive when there are many variables because the number of variable pairs grows quickly. Segment and time analyses can also become costly with high-cardinality categories or very large datasets. The practical tradeoff is depth versus speed: start with broad, inexpensive checks, then spend more computation and analyst time on suspicious fields and important relationships. There is also a statistical tradeoff. Searching many segments or correlations can produce patterns by chance, so EDA findings should usually generate questions or hypotheses rather than automatic causal conclusions.
Interviewers want to see whether the candidate knows how to understand and validate data before drawing conclusions. A strong answer shows disciplined reasoning about grain, data quality, distributions, relationships, segmentation, time behavior, leakage, uncertainty, and the difference between an interesting pattern and evidence that is safe to use for a model or decision.
Common mistakes are starting with correlations or a model before defining the data grain; assuming stored data types have the correct analytical meaning; dropping every missing value or outlier without understanding why it exists; checking only exact duplicates while ignoring repeated business keys; relying only on averages and missing skewed distributions; treating correlation as causation; slicing into many small segments and overinterpreting noise; ignoring trends, seasonality, or structural breaks; using future or post-outcome information and creating leakage; and producing charts without translating findings into fixes, questions, hypotheses, visualizations, or constraints.
Present EDA as a sequence with a purpose, not as a list of charts. Start with grain and data quality, move to distributions, relationships, segments, and time, finish with leakage, and explicitly say what each finding becomes next: a fix, question, hypothesis, visualization, or constraint.










