Finding indicators

Start here when you know what you want to measure but not the indicator’s id.

search(text, *, all_sources=False, breakdowns=False, coverage=True, limit=20)[source]

Search for indicators by what they measure.

Results whose names contain more of your words come first. Each indicator appears once, as its total where one exists, with a count of the breakdowns (by sex, age…) behind it; undata.breakdowns() lists them.

Parameters:
  • text (str) – Plain words, such as "maternal mortality" or "access to electricity".

  • all_sources (bool) – Also show series that Data Commons imported from elsewhere. Off by default: some are older copies of UN data, ranked above the UN’s own.

  • breakdowns (bool) – List every breakdown as its own row instead of one row per indicator.

  • coverage (bool) – Add how many places have data and which years, in one extra request.

  • limit (int) – The most rows to return.

Returns:

A table with indicator (the id to pass to undata.get()), name, source, and with coverage on, places and years. Best match first.

Return type:

DataFrame

Example

>>> import undata as un
>>> un.search("under-five mortality")
about(indicator)[source]

Describe an indicator: its name, source, unit and how much data exists.

For a series that reports an SDG indicator, it also gives the indicator number and a link to the official metadata: the definition, method and custodian agency.

Parameters:

indicator (str) – An id, as shown in the indicator column of search(), or an SDG indicator number such as "3.1.1".

Example

>>> import undata as un
>>> un.about("undata/sdg/SH_STA_MORT.SEX--F")
Maternal mortality ratio [Sex=Female]
  id            undata/sdg/SH_STA_MORT.SEX--F
  source        SDG Global Database
  ...
class IndicatorInfo(indicator, name, source, unit, first_year, last_year, places, observations, sdg_indicator='', metadata='')[source]

What an indicator is, where it comes from, and how much data it has.

breakdowns(indicator)[source]

List every breakdown of an indicator: by sex, age, wealth and so on.

Parameters:

indicator (str) – An indicator id, or an SDG indicator number such as "16.1.2".

Returns:

A table with indicator (the id to pass to undata.get()), name, and one column per dimension (sex, age…) holding readable values. The total, with no breakdown, comes first.

Return type:

DataFrame

Example

>>> import undata as un
>>> un.breakdowns("undata/sdg/VC_DTH_TOTN")

The SDG framework

Walk from a goal down to the series you can fetch: goals(), then targets(16), then indicators("16.1"), then series("16.1.2").

goals()[source]

List the 17 Sustainable Development Goals.

Returns:

A table with columns goal and name.

Return type:

DataFrame

Example

>>> import undata as un
>>> un.sdg.goals()
  goal                                               name
0    1                    End poverty in all its forms everywhere
...
targets(goal)[source]

List the targets under one goal.

Parameters:

goal (int | str) – The goal number, such as 16.

Returns:

A table with columns target (such as 16.1) and name.

Return type:

DataFrame

indicators(target)[source]

List the indicators under one target.

Parameters:

target (str) – The target number, such as "16.1" or "4.a".

Returns:

A table with columns indicator (such as 16.1.2) and name.

Return type:

DataFrame

series(indicator)[source]

List the data series that report one SDG indicator, ready for undata.get().

An indicator is usually reported through several series: a count and a rate, or a total and its breakdowns by sex and age.

Parameters:

indicator (str) – The indicator number, such as "16.1.2".

Returns:

A table with columns indicator (the id to pass to undata.get()), name, and total, which is True for a series with no breakdown. Totals come first.

Return type:

DataFrame

Example

>>> import undata as un
>>> un.sdg.series("16.1.2")
               indicator                                               name  total
0  undata/sdg/VC_DTH_TOTR  Number of total conflict-related deaths per 100...   True
...