Beginner level · Module 2: Exploratory Data Analysis with pandas · Lesson 1 of 3
Summarising Variables
Describe each variable's distribution, missing values and categories before analysing relationships.
In this lesson you will
- Summarise numeric and categorical variables
- Identify missing and unusual values
Key concepts
describe()value_counts()missing valuesdistribution
The lesson
For numeric variables, describe() gives count, mean, spread and percentiles; a histogram shows the shape. For categorical variables, value_counts() shows how often each category appears, with normalize=True for percentages.
Count missing values with df.isna().sum() and look at which rows are missing. Missing data is rarely random: households that were not home may differ from those that were.
Look for values that cannot be true — negative ages, a walk of 900 minutes — and decide with the data owners whether they are errors.
Step by step
- Describe the numeric variables.
- Count categories for water source and district.
- Count and inspect missing values.
- List impossible or suspicious values.
Practice activity
Write a variable-by-variable summary of the water survey.
Expected result: A summary listing each variable's distribution, missing values and problems.
Check your understanding
-
Which method counts each category's frequency?
Show answer
value_counts().
-
Why look at which rows have missing values?
Show answer
Missingness is often linked to who or what was not measured, which can bias results.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.