Countries, regions and groups

undata ships the UN Statistics Division’s M49 standard: 248 countries and areas with their official names, M49 regions and sub-regions, and the current UN lists of least developed countries (LDCs), landlocked developing countries (LLDCs) and small island developing States (SIDS). Places the platform holds outside M49 are in no list, region or group, and can be reached only by platform code (such as country/XKS).

countries(region=None)[source]

List countries and areas, all of them or those in one region or group.

The list is the UN’s M49 standard, with official UN names.

Parameters:

region (str | None) – A region or group such as "Western Africa", "Asia" or "SIDS". Leave it out for every country and area.

Returns:

A table with country, iso3, m49, region, sub_region, and ldc, lldc and sids as true or false. Sorted by name.

Return type:

DataFrame

Example

>>> import undata as un
>>> len(un.countries("LDCs")) > 40
True
regions()[source]

List every region and UN group you can use wherever undata asks for countries.

Returns:

A table with region, kind (region or group), code (the M49 code or group key), countries (how many), and published_total (whether the platform holds a figure published for the region itself, for undata.totals()).

Return type:

DataFrame

Example

>>> import undata as un
>>> "Southern Asia" in set(un.regions()["region"])
True

Resolving names yourself

resolve(name)[source]

Return the country, region or group a name refers to.

Parameters:

name (str) – A UN name or common name, an ISO3 or M49 code, a region or group name, or a platform code such as country/XKS for a place outside M49.

Raises:

Example

>>> import undata as un
>>> un.places.resolve("Vietnam").name
'Viet Nam'
>>> un.places.resolve("LDCs").kind
'group'
expand(places)[source]

Resolve names to countries, expanding each region or group into its countries.

Order is kept and duplicates are dropped, so ["Nepal", "Southern Asia"] lists Nepal once.

m49()[source]

The UN M49 list shipped with undata: every country and area with an ISO code.

class Place(id, name, kind, members=())[source]

A country, a region, a UN group, or an area outside M49.

id

The platform’s identifier: country/BGD for a country, or the id of the figure published for a region (m49/... when none is published).

Type:

str

name

The UN name.

Type:

str

kind

"country", "region", "group", or "area" for a place outside M49 asked for by its platform code.

Type:

Literal[‘country’, ‘region’, ‘group’, ‘area’]

members

For a region or group, the ISO3 codes of its countries.

Type:

tuple[str, …]

class Country(iso3, m49, name, region, sub_region, intermediate_region, ldc, lldc, sids, developed)[source]

One row of the UN M49 standard.