twoHelixestwoHelixes Start free

Datasets / World health and longevity

Change in life expectancy since 1990

Change is measured per country between its 1990 value and its latest observed value, so countries with different coverage are still compared on their own history.

Question how has life expectancy changed since 1990 by country?
Life expectancy change since 19900102030South SudanLiberiaAngolaEthiopiaUgandaNigerEritreaBurundiSierra LeoneGuinea-BissauNepalTanzaniaChange
World health and longevity — 25 rows charted from 8,229, drawn as a hbar
How it decided
Finding the data23 ms

World health and longevity: 8,229 rows, 8 columns. country, year and life_expectancy in 1990 and in the latest year per country.

Shaping the data41 ms

8,229 rows in, 25 out across 4 columns. Change is measured per country between its 1990 value and its latest observed value, so countries with different coverage are still compared on their own history.

Choosing the chart12 ms

hbar. A per-country before-and-after difference is one bar per country, sorted by the size of the change.

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.

base = df[df["year"] == 1990][["country", "life_expectancy"]].dropna()
base = base.rename(columns={"life_expectancy": "life_1990"})
latest = df.dropna(subset=["life_expectancy"]).sort_values("year")
latest = latest.groupby("country", as_index=False).tail(1)
latest = latest[["country", "life_expectancy"]].rename(
    columns={"life_expectancy": "life_latest"})
joined = base.merge(latest, on="country", how="inner")
joined["change"] = joined["life_latest"] - joined["life_1990"]
result = (joined.sort_values("change", ascending=False)
          .head(25)
          .reset_index(drop=True))

What it charted

25 rows out of 8,229, 4 columns. First 8 shown.

countrylife_1990life_latestchange
South Sudan28.627557.617428.9899
Falkland Islands53.33679.213225.8772
Liberia37.643562.162524.519
Malawi43.574867.353523.7787
Angola41.854264.61722.7628
East Timor45.184967.689422.5045
Ethiopia45.116667.31522.1984
Afghanistan45.118366.034620.9163