Datasets / World health and longevity
Child mortality against fertility, latest year per country
Each country is one point at its latest observed pair, so the shape of the relationship across countries is visible without mixing years.
How it decided
World health and longevity: 8,229 rows, 8 columns. fertility_rate and child_mortality_pct at the latest year per country; missing pairs are dropped.
8,229 rows in, 200 out across 2 columns. Each country is one point at its latest observed pair, so the shape of the relationship across countries is visible without mixing years.
scatter. Two measures with no time axis is a scatter; one point per country keeps every country visible.
Palette, spacing, axis titles and legend placement applied. 0 issues found.
The transformation
This is the code, not a description of it — the chart above was drawn from what it returns, and the notebook download runs the same lines against the same file.
latest = df.dropna(subset=["child_mortality_pct", "fertility_rate"])
latest = latest.sort_values("year")
latest = latest.groupby("country", as_index=False).tail(1)
result = latest[["fertility_rate", "child_mortality_pct"]].dropna()
What it charted
200 rows out of 8,229, 2 columns. First 8 shown.
| fertility_rate | child_mortality_pct |
|---|---|
| 0.916 | 0.54 |
| 4.84 | 5.49 |
| 5.124 | 5.05 |
| 1.364 | 0.58 |
| 1.348 | 0.94 |
| 2.712 | 2.01 |
| 1.463 | 0.48 |
| 6.12 | 10.06 |