Skip to main content

HDX Python country mapping utilities

Project description

Travis-CI Build Status Coveralls Build Status

The HDX Python Country Library provides country mappings including ISO 2 and ISO 3 letter codes (ISO 3166) and regions (uses World Bank live api with static file fallback)

Usage

The library has detailed API documentation which can be found here: http://ocha-dap.github.io/hdx-python-country/. The code for the library is here: https://github.com/ocha-dap/hdx-python-country.

Countries

The usage of the country mappings functionality is best illustrated by some examples:

from hdx.location.country import Country

Country.get_country_name_from_iso3('jpn')  # returns 'Japan'
Country.get_country_name_from_iso2('Pl')  # returns 'Poland'
Country.get_iso3_country_code('UZBEKISTAN')  # returns 'UZB'

Country.get_iso3_country_code_partial('Sierra')
# performs partial match and returns ('SLE', False)

Country.get_country_info_from_iso2('jp')
# {'id': 'JPN', 'iso2Code': 'JP', 'name': 'Japan',
# 'latitude': '35.67', 'longitude': '139.77',
# 'region': {'value': 'East Asia & Pacific', 'id': 'EAS'},
# 'adminregion': {'value': '', 'id': ''}, 'capitalCity': 'Tokyo',
# 'incomeLevel': {'value': 'High income', 'id': 'HIC'},
# 'lendingType': {'value': 'Not classified', 'id': 'LNX'}}

Country.get_countries_in_region('South Asia')
# ['AFG', 'BGD', 'BTN', 'IND', 'LKA', 'MDV', 'NPL', 'PAK']

Valid regions are:

{'EAS': 'East Asia & Pacific', 'SAS': 'South Asia',
'MEA': 'Middle East & North Africa', 'ECS': 'Europe & Central Asia',
'LCN': 'Latin America & Caribbean ', 'NAC': 'North America',
'SSF': 'Sub-Saharan Africa '}

Project details


Release history Release notifications | RSS feed

This version

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hdx-python-country-0.5.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

hdx_python_country-0.5-py2.py3-none-any.whl (8.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file hdx-python-country-0.5.tar.gz.

File metadata

File hashes

Hashes for hdx-python-country-0.5.tar.gz
Algorithm Hash digest
SHA256 9c0b94e3c0859e7f8b6c0dca524d72b0550b95cc8f3fbbb4b60516e722e2ffd5
MD5 019817b63595d0a366c12417442c32e8
BLAKE2b-256 70c5329e2908152319dad8ff77331057fa6893afc63f2d680f096aae20d5b1e8

See more details on using hashes here.

File details

Details for the file hdx_python_country-0.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for hdx_python_country-0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 326f4e00be10106119532cbd72dd9cd4bc288ed921b3965df00cac8f27c91b38
MD5 f53b52ffb0b6e7a4ce982ce93f19264e
BLAKE2b-256 c7f0ae8986b7b3fd9eaeb87e1be683c0e0f9e2bd7b8374a366abc775b1429534

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page