FoodHub Data Science Track · Lesson 1

What is Exploratory Data Analysis (EDA)?

Before you can answer questions with data, you need to understand what questions the data is capable of answering. EDA is the discipline of looking before you leap.

The Core Idea

Exploratory Data Analysis is the practice of investigating a dataset before you do anything formal with it — before you run a model, before you write a report, before you draw a conclusion. It is, at its heart, a conversation between you and the data.

The term was coined by the statistician John Tukey in his 1977 book of the same name. Tukey's insight was that statistics had become too focused on confirming hypotheses and not enough on discovering what was actually in the data. He argued that looking at data visually and descriptively — without a predetermined question — often reveals things that no formal model ever would.

John Tukey, 1977 "The greatest value of a picture is when it forces us to notice what we never expected to see."

That phrase captures the entire EDA philosophy: surprise is a signal. If a chart shows you something you didn't expect, that unexpected thing is probably worth investigating. EDA is the process of creating conditions where surprises can surface.

In practice, EDA means running df.info(), df.describe(), and df.value_counts() before you touch anything else. It means plotting histograms. It means grouping by categories and looking at the differences. It means asking "wait, why is that?" dozens of times before you're done.

The Three Phases of EDA

EDA is not random exploration — it follows a rough sequence. Each phase builds on the previous one, moving from understanding the structure of the data to understanding the relationships within it.

Phase 1

Understand the Structure

How many rows and columns? What are the data types? Which columns have missing values, and how many? Are there duplicates? What do the column names mean? This is triage — you are establishing whether the data is usable at all.

Phase 2

Summarise Distributions

Look at each variable in isolation. What is the typical value? What is the spread? Is the distribution symmetric or skewed? Are there obvious outliers? Use histograms, box plots, and summary statistics — one variable at a time.

Phase 3

Find Relationships

Now look at pairs and groups. Does delivery time vary by day of the week? Are ratings higher for certain cuisines? Do expensive orders take longer to prepare? Scatter plots, correlation matrices, and grouped comparisons live here.

It's important to note that these phases are iterative, not sequential. Something you discover in Phase 3 might send you back to Phase 1 to re-examine a column you thought you understood. That's not a failure of method — it's EDA working as designed.

Phase 1 in Practice: Structure Checks

When you first load a dataset, your instinct might be to jump straight to interesting questions. Resist that. Run these first:

df.shape # How many rows and columns? df.dtypes # What type is each column? df.isnull().sum() # How many missing values per column? df.duplicated().sum() # Any duplicate rows? df.head() # What do the first few rows look like? df.describe() # Summary statistics for numeric columns

This structural scan takes two minutes and prevents hours of debugging later. A column you think is numeric might be stored as a string. A column you think has no missing values might have them encoded as the text "Not given" rather than as NaN. You can't know until you look.

Why EDA Before Modelling?

The temptation in data science is to move quickly to the interesting part — building a model, finding patterns, making predictions. EDA can feel like groundwork, like checking whether the foundations are solid before building the house. But skip it, and the house falls down.

Specifically, skipping EDA risks the following:

Concrete Example In the FoodHub dataset, the rating column contains the text string "Not given" for orders where no rating was submitted. If you had gone straight to a correlation analysis between rating and delivery_time, the analysis would have failed silently or returned nonsense — because you can't compute a correlation between a number and a string. EDA catches this before it damages downstream work.

What EDA Does NOT Do

EDA is powerful, but it is important to understand its limits. EDA generates hypotheses — it does not prove them.

When you look at a boxplot and notice that weekend orders seem to have faster delivery times than weekday orders, that is an observation, not a finding. It could be a real pattern. It could be random variation in this particular sample. It could be an artefact of how the data was collected.

To know whether an observed pattern is real — to distinguish signal from noise — you need confirmatory analysis: statistical tests, confidence intervals, cross-validation. EDA is the first step of a larger process, not the last.

EDA vs Confirmatory Analysis EDA asks: "What might be going on here?" Confirmatory analysis asks: "Is what I think is going on actually supported by the data?" In the FoodHub project, EDA revealed the weekday/weekend delivery time difference — and hypothesis testing (a Welch t-test) later confirmed it was statistically significant.

There is also a risk of data dredging: if you look at enough variables in enough combinations, you will eventually find something that looks like a pattern purely by chance. EDA is not a licence to hunt for patterns and report the ones that seem interesting. The patterns you find through EDA should be stated as hypotheses and then tested with held-out data or proper statistical methods.

The EDA Mindset

Technical skills — knowing how to plot a histogram, how to group by a category, how to compute a correlation — are the tools of EDA. But EDA is also a mindset, and the mindset is more important than the tools.

Be Suspicious

Treat everything the data tells you as provisional until you've verified it. If a column has no missing values, check that missing data isn't encoded as 0, or -1, or "N/A", or "Not given". If the average looks reasonable, check the distribution — the average of two very different groups looks like neither group.

Ask "Why?" for Every Chart

Don't just record observations — interrogate them. If the median order cost on weekends is higher than on weekdays, ask why. Is it because people order more expensive food on weekends? Because different restaurants are popular? Because the customer demographic changes? The chart raises the question; your follow-up analysis answers it.

Look for the Unexpected

The most valuable discoveries in EDA are usually the ones you weren't looking for. You open the data planning to check delivery times, and you accidentally notice that a particular restaurant has ten times more orders than any other. You were looking for one thing; the data showed you something else. Those accidental discoveries are often more valuable than the ones you planned.

The central discipline of EDA is staying curious longer than feels comfortable. The urge to move on to modelling is strong. The analyst who spends an extra hour in EDA — being thorough, being suspicious, being genuinely curious — saves days of backtracking later.
In the FoodHub Project

EDA on the FoodHub dataset revealed three findings that would have been completely invisible without it: that 39% of ratings were missing (encoded as "Not given" rather than NaN, which required deliberate cleaning before any rating analysis could proceed); that weekday delivery was actually slower than weekend delivery by nearly six minutes — counterintuitive, given that weekdays have more predictable demand; and that cuisine type had almost no correlation with customer ratings, suggesting that what customers care about is not what type of food they ordered. None of these were the planned focus of the analysis. All of them shaped it significantly. See the full analysis at the FoodHub project page.