twoHelixestwoHelixes Start free

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.

Question is child mortality related to fertility in the latest year?
Child mortality against fertility025810120.9161.8234.2171.5981.4334.6061.4441.7491.7132.249Fertility Rate
World health and longevity — 200 rows charted from 8,229, drawn as a scatter
How it decided
Finding the data19 ms

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.

Shaping the data23 ms

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.

Choosing the chart2 ms

scatter. Two measures with no time axis is a scatter; one point per country keeps every country visible.

Applying defaults1 ms

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_ratechild_mortality_pct
0.9160.54
4.845.49
5.1245.05
1.3640.58
1.3480.94
2.7122.01
1.4630.48
6.1210.06