Descriptive Statistics
Descriptive statistics summarise a dataset so that people can understand it at a glance. They describe only the data in front of you. They make no claims about anyone you did not measure.
A list of 365 daily temperatures is hard to read. "The average was 14.2 °C, ranging from −3 °C to 33 °C, with most days between 8 °C and 20 °C" is easy. That sentence is descriptive statistics.
The three main questions
| Question | Called | Typical measures |
|---|---|---|
| Where is the middle of the data? | Central tendency | mean, median, mode |
| How spread out is it? | Variation (dispersion) | range, interquartile range, variance, standard deviation |
| What shape does it have? | Distribution | frequency tables, histograms, box plots, skewness |
Numbers and pictures work together: a single number such as the mean is compact but can hide important features, while a chart shows the shape but is harder to compare precisely.
A quick summary in Python
Suppose a support team logged how many minutes it took to answer 12 customer emails:
import statistics
minutes = [12, 8, 15, 10, 11, 40, 10, 13, 9, 14, 11, 10]
print("count :", len(minutes))
print("mean :", round(statistics.mean(minutes), 2))
print("median:", statistics.median(minutes))
print("mode :", statistics.mode(minutes))
print("min :", min(minutes), " max:", max(minutes))
print("stdev :", round(statistics.stdev(minutes), 2))count : 12
mean : 13.58
median: 11.0
mode : 10
min : 8 max: 40
stdev : 8.56
Notice that the mean is noticeably larger than the median. One slow reply (40 minutes) pulls the mean up, while the median, the middle value, barely notices it. Comparing several measures side by side is how you spot such features.
describe(): a whole summary in one call
pandas bundles the most common descriptive statistics into one method:
import pandas as pd
minutes = pd.Series([12, 8, 15, 10, 11, 40, 10, 13, 9, 14, 11, 10], name="minutes")
print(minutes.describe().round(2))count 12.00
mean 13.58
std 8.56
min 8.00
25% 10.00
50% 11.00
75% 13.25
max 40.00
Name: minutes, dtype: float64
The rows are: the number of values, the mean, the standard deviation, the minimum, the 25th percentile, the median (50%), the 75th percentile and the maximum. You will learn each of them in this section.
Describing several variables
For a table with several columns, describe() summarises every numeric column at once. Here a seeded generator invents data for 50 delivery drivers:
import numpy as np
import pandas as pd
rng = np.random.default_rng(3)
drivers = pd.DataFrame({
"deliveries": rng.poisson(28, size=50),
"km_driven": rng.normal(110, 18, size=50).round(1),
"rating": rng.choice([3, 4, 5], size=50, p=[0.1, 0.4, 0.5]),
})
print(drivers.describe().round(1)) deliveries km_driven rating
count 50.0 50.0 50.0
mean 28.2 110.7 4.5
std 4.9 17.4 0.6
min 17.0 69.0 3.0
25% 25.2 98.1 4.0
50% 28.0 110.5 5.0
75% 31.8 121.8 5.0
max 37.0 154.3 5.0
At a glance you can tell that drivers made between 17 and 37 deliveries, that the middle half of them drove between about 98 and 122 km, and that ratings cluster at 4 and 5 (the median rating is already 5).
Descriptive vs. inferential
Descriptive statistics answer "what does this data look like?". If the 50 drivers are the whole fleet, the summary above is the complete truth about the fleet. If they are a sample of a much larger company, the same numbers become estimates, and you would need inferential statistics (covered later) to say how close they are likely to be to the company-wide values.
Tip: Always start an analysis with descriptive statistics and a few charts. They catch data-entry errors, outliers and surprises before you run any formal test.
Test yourself
Which question is answered by a measure of *central tendency*?
- How spread out are the values?
- What is a typical or middle value?
- Is the difference between two groups significant?
- How many values are missing?
In the email example the mean (≈13.6) is larger than the median (11). What most likely causes this?
- A data-entry error in the median
- A few unusually large values pull the mean upward
- The mode is too small
- There are too few values
Which pandas method prints count, mean, std, min, quartiles and max?
df.info()df.describe()df.summary()df.stats()