Sub topic 1
What a first exploratory analysis is for
Prerequisites
This chapter assumes you can read basic Python (variables, lists, dictionaries, functions). It also assumes pandas and matplotlib are installed, and that you can run code in a Jupyter notebook or a Python script. No pandas experience is required yet. Later chapters introduce each function when it is first used.
What exploratory analysis means
Exploratory data analysis (EDA) is the practice of looking at a dataset before you model it or draw conclusions from it. You check what the data contains, how complete it is, and what patterns appear. The goal is to understand the table well enough to ask better questions.
EDA does not prove anything. It produces observations and hypotheses. Confirming a hypothesis takes a separate step, such as a statistical test or a model that you validate on held-out data.
This tutorial uses the Titanic passenger list. Each row is a passenger. The columns include Survived (0 or 1), Pclass (ticket class), Sex, Age, Fare, and Embarked (port of boarding). The data is small, familiar, and has real flaws, such as missing ages. That makes it a good dataset for practicing.
What you are trying to find out
A first pass answers a short list of questions:
- How big is the table, and what does one row represent?
- Does each column have the type you expect, such as numbers stored as numbers?
- Which values are missing, and how many?
- Are there duplicate rows or values that cannot be right, such as a negative age?
- How are the numeric columns distributed, and which categories are common or rare?
- Do outcomes differ between groups, for example survival by class or sex?
- Which columns move together?
Each question maps to a technique you will meet in later chapters.
| Question | Technique | Chapter topic |
|---|---|---|
| Size and types | `shape`, `head`, `info` | First look |
| Missing values | `isna().sum()` | Missing values |
| Distributions | `describe`, `value_counts` | Summaries and counts |
| Group differences | `groupby` | Comparing groups |
| Shape of data | `plot.hist`, `plot.bar` | Plotting |
| Relationships | `corr` | Correlation |
The workflow
The chapters follow a fixed order. Early steps check the data's quality, because later results depend on it. If a third of the ages are missing, every statement about age rests on the other two thirds.
The loop at the end matters. Findings usually raise new questions, and those send you back to the data.
Habits that keep an analysis honest
- Keep the raw data unchanged. Add new columns instead of overwriting old ones, so you can always compare against the original.
- Write down each question before you run code. A stated question prevents you from searching until something looks interesting.
- Report counts next to percentages. A survival rate of 100% means little if it rests on two passengers.
- Treat correlations and group differences as clues. They do not show cause.
- Record what you did and what you found, including the caveats. Your future self will not remember them.
What you will produce
By the end you will have a notebook that runs top to bottom. It loads the data, checks its quality, summarizes it, compares groups, and plots a few results. It ends with a short written list of findings, caveats, and next questions. You can reuse the same routine on any new table.
Exercise
A colleague says, "In this dataset, first-class passengers survived at a higher rate, so first class caused survival." Using what this chapter says about EDA, what is wrong with the statement, and what would you report instead?
Show answer
EDA produces observations and hypotheses, not proof of cause. Class may be tied to other factors, such as sex, age, or cabin location, that also affect survival. Report the observed rates for each class together with the number of passengers in each group, and note that the pattern is a lead for further questions, not a causal claim.