Analyses¶
The analyses UN reports run most often, one function each. Every result works with
undata.describe() (which writes the finding), undata.chart() (which draws the
chart made for it), undata.save() and undata.ai_pack().
Progress towards a target¶
undata.progress() follows the UN Statistics Division’s Technical Note for Progress
Assessment, the method behind the SDG Report’s progress charts:
Take each country’s value at the baseline (2015, or the first year after with data) and its latest value, and their compound annual growth rate.
With a target, project the latest value to the target year at that rate, and divide the projected change by the change the target needs. A ratio of 1 means the target is reached on time.
Without a target, score the growth rate itself, against fixed thresholds.
Place each country in one of the SDG Report’s categories, with a score from 0 to 5:
Category |
With a target (ratio) |
Without a target (annual growth) |
|---|---|---|
On track or target met |
0.95 or more |
2% or more |
Moderate progress, but acceleration needed |
0.50 to 0.95 |
1.25% to 2% |
Marginal progress, and significant acceleration needed |
0.10 to 0.50 |
0.5% to 1.25% |
Stagnation |
0 to 0.10 |
0 to 0.5% |
Regression |
below 0 |
below 0 |
When lower is better (mortality, poverty), the growth thresholds are mirrored. A country that already met the target at the baseline is on track while it still meets it.
- progress(indicator, countries, *, better, target=None, baseline=2015, target_year=2030)[source]¶
Assess each country’s progress towards an SDG target, by the UN’s own method.
This applies the UN Statistics Division’s “trend to target” method, from the Technical Note for Progress Assessment of The Sustainable Development Goals Report 2026, to each country:
With a 2030
target: the growth rate since the baseline is projected to 2030, and the projected change is compared with the change needed to reach the target.Without one: the growth rate itself is compared with fixed thresholds.
Each country gets one of five statuses, from “On track or target met” to “Regression”, and a score from 0 to 5. Countries with fewer than two years of data since the baseline are marked “Insufficient data”. The note does not cover a country already past the target at the baseline; undata applies the note’s rule for a baseline equal to the target: on track while the latest value still meets it.
- Parameters:
indicator (str) – An indicator id, or an SDG number such as
"3.1.1".countries (str | Iterable[str]) – Countries, regions or groups, such as
"LDCs".better (Literal['higher', 'lower']) –
"lower"if a fall is progress (deaths, poverty),"higher"if a rise is (access, completion). Required: undata will not guess.target (float | None) – The 2030 target value, such as 70 for maternal mortality (target 3.1). Leave out for indicators without a numerical target.
baseline (int) – The baseline year. The note uses 2015, or the first later year with data.
target_year (int) – The year the target is for.
- Returns:
One row per country with its status, score, baseline and latest values, growth rate, and (with a target) the 2030 projection.
.attrs["summary"]counts the countries per status, and.attrs["method"]cites the method.- Return type:
Example
>>> import undata as un >>> table = un.progress("3.1.1", "LDCs", target=70, better="lower")
- STATUSES¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
Other analyses¶
- profile(country, indicators, *, since=2015)[source]¶
One country across many indicators, beside its region and the world.
For each indicator: the country’s latest value and year, the published figure for its M49 region and for the world (when the platform holds one), its rank among the countries of its region (1 is the highest value), and its growth rate since
since.- Parameters:
- Returns:
One row per indicator.
- Return type:
Example
>>> import undata as un >>> un.profile("Chad", ["undata/sdg/EG_ACS_ELEC", "3.1.1"])
- gap(indicator, countries, *, by='sex', groups=None)[source]¶
The gap between two groups in each country: women and men, rural and urban.
For each country, the latest year in which both groups have a value is used, so the two are always compared like with like.
- Parameters:
indicator (str) – An indicator id, or an SDG number, that has the breakdown.
countries (str | Iterable[str]) – Countries, regions or groups.
by (str) – The breakdown, such as
"sex","urbanization"or"wealth quantile".groups (tuple[str, str] | None) – The two groups to compare, as the breakdown names them. Defaults to female and male, rural and urban, or poorest and richest quintile.
- Returns:
One row per country – the year, each group’s value,
ratio(first group divided by the second: for sex, the parity index),difference, and for sex,parity(true when the ratio is within 0.97 to 1.03).- Return type:
Example
>>> import undata as un >>> completion = "undata/sdg/SE_TOT_CPLR.EDUCATION_LEVEL--ISCED11_1" >>> un.gap(completion, "Western Africa")
- trend(indicators, countries, *, since=2015)[source]¶
How each country moved since a baseline year: the change and the annual growth rate.
The start is
sinceif there is data for it, otherwise the first later year (the UN’s baseline rule); the end is the latest year with data.- Parameters:
- Returns:
One row per country and indicator – start and end years and values, the change, and
cagr_pct, the compound annual growth rate in percent.- Return type:
Example
>>> import undata as un >>> un.trend("undata/sdg/EG_ACS_ELEC", "Western Africa")
- benchmark(indicator, places=('World', 'LDCs', 'LLDCs', 'SIDS'), *, baseline=2015)[source]¶
Compare regions and UN groups using the totals the agency published for them.
- Parameters:
- Returns:
One row per place – baseline and latest values and years, the change and the annual growth rate. Places without a published total are named in a warning.
- Return type:
Example
>>> import undata as un >>> un.benchmark("3.1.1")
- availability(indicators, countries, *, within=None)[source]¶
Which countries report which indicators, and how recently.
- Parameters:
- Returns:
A grid with countries down the side and indicators across the top, holding the year of each country’s latest value, blank where there is none.
.attrsholds the share of countries reporting each indicator.- Return type:
Example
>>> import undata as un >>> un.availability(["3.1.1", "undata/sdg/EG_ACS_ELEC"], "SIDS")