Arjun works nights as a data analyst at a consumer loan fintech in Hyderabad. Tomorrow he'll present his first credit-committee meeting — a room of risk officers and executives. He has 150 loan records and 15 minutes to build one-pager summary slides.
Instead of manually scanning CSV rows, he runs df.describe(). In five seconds, he sees the mean loan amount, its spread, outliers, and distribution shape. The numbers go straight onto his slide. Same stats work for any loan portfolio — Mumbai, São Paulo, Lagos — the shape of lending data is universal.
- Run
.describe()for instant summaries - Understand mean vs median and when each matters
- Measure spread with std, variance, IQR, and range
- Spot skewed & kurtotic distributions
- Describe categorical columns with
.describe(include='object') - Calculate custom percentiles with
.quantile() - Unlock groupby summaries for next lesson
The one-shot summary: df.describe()
When you have a DataFrame with numerical columns, df.describe() runs eight statistics at once and displays them in a styled table.
| Stat | amount_inr | interest_rate | tenure_months | applicant_age | credit_score |
|---|---|---|---|---|---|
| count | 130.0 | 150.0 | 150.0 | 150.0 | 150.0 |
| mean | 116,469 | 12.7 | 54.5 | 37.8 | 718.0 |
| std | 89,803 | 1.4 | 19.2 | 9.7 | 64.1 |
| min | 28,000 | 9.8 | 24.0 | 23.0 | 580.0 |
| 25% | 59,250 | 11.7 | 42.0 | 29.0 | 670.0 |
| 50% (median) | 77,500 | 12.7 | 54.0 | 36.0 | 720.0 |
| 75% | 153,750 | 13.8 | 66.0 | 45.0 | 770.0 |
| max | 420,000 | 15.5 | 102.0 | 60.0 | 825.0 |
Mean vs median: the skew tells the story
Both measure "center" but behave differently when data is skewed. The histogram below shows loan amounts with mean (blue), median (amber), and mode (green) marked.
Measures of spread: std, variance, IQR, range
Standard deviation (std) tells you how scattered data is around the mean. Variance is std squared. IQR (interquartile range) is robust to outliers. Range is just max − min.
Skewness & kurtosis: the shape of distributions
Skewness measures asymmetry (right-tail? left-tail?). Kurtosis measures tail heaviness (sharp peaks or fat tails?). Both are built into pandas.
Categorical columns: .describe(include='object')
Non-numerical columns (strings, categories) get their own summary: count, unique values, top (most common), and frequency.
| Stat | employment_type | city |
|---|---|---|
| count | 150 | 150 |
| unique | 3 | 6 |
| top (most common) | Salaried | Mumbai |
| freq | 118 | 33 |
freq row flags if one category dominates (risk for bias or seasonal effects); here Salaried concentration is a watchpoint.
Custom percentiles with .quantile()
Percentiles carve data into slices. Use them to spot tail risk: P99 tells you the worst 1% of loans. P1 tells you the best.
| Percentile | Loan Amount | Interpretation |
|---|---|---|
| P1 (1st percentile) | ₹38,870 | Bottom 1% of loans |
| P5 (5th percentile) | ₹45,000 | Bottom 5% |
| P50 (median) | ₹77,500 | Middle 50% |
| P95 (95th percentile) | ₹325,500 | Top 5% |
| P99 (99th percentile) | ₹383,550 | Top 1% (tail risk) |
.describe(include='all') give you that .describe() alone doesn't?You're ready to move to groupby and pivot operations.