Skip to main content

pycountry-convert

Extension of Python package pycountry providing conversion functions.

Badges

docs

Documentation Status License Status

info

Hits Contributors

tests

Travis-CI Build Status Code Coverage Status

package

PyPI Package latest release Supported versions

other

Requirements Status

Install

pip install pycountry-convert

Architecture

Using country data derived from wikipedia, this package provides conversion functions between ISO country names, country-codes, and continent names.

Functions

  • map_countries(cn_name_format="default", cn_extras={}): Return a dict of countries with key as country name (standard and official) with ISO 3166-1 values Alpha 2, Alpha 3, and Numeric. This mapping will include countries defined within pycountry, Wikipedia, and whatever extra countries provided by parameter cn_extras. Parameter cn_name_format will format the country name as request to either be using the default layout “default”, lowercase “lower”, or uppercase “upper”.

  • country_alpha2_to_continent_code(): Convert country code ISO 3166-1 alpha-2 to continent name.

  • country_alpha2_to_country_name(cn_name_format="default"): Convert country code ISO 3166-1 alpha-2 to country name.

  • country_name_to_country_alpha2(cn_name, cn_name_format="default"): Convert country name to country code ISO 3166-1 alpha-2 .

  • country_alpha3_to_country_name(cn_name_format="default"): Convert country code ISO 3166-1 alpha-3 to country name.

  • country_name_to_country_alpha3(cn_name, cn_name_format="default"): Convert country name to country code ISO 3166-1 alpha-3 .

  • country_alpha3_to_country_alpha2(): Convert country code ISO 3166-1 alpha-3 to country code ISO 3166-1 alpha-2 .

Parameter: cn_name_format

  • COUNTRY_NAME_FORMAT_DEFAULT "default": Country names as provide by pycountry.

  • COUNTRY_NAME_FORMAT_LOWER "lower": All lowercase country names.

  • COUNTRY_NAME_FORMAT_UPPER "upper": All uppercase country names.

Parameter: cn_extras

Dictionary of { cn_name: cn_alpha2_code, … }

Dependencies

pycountry-convert module is built upon Python 3 and has dependencies upon several Python modules available within Python Package Index PyPI.

Release History

0.7.2 (2018-02-16)

  • Python 2.7 supported

  • Travis CI testing both Python 2.7 and 3.6.

0.7.1 (2018-02-15)

  • migrate to github/TuneLab.

  • Python 2.7 support

  • lru_cache()

0.6.7 (2018-02-15)

  • pycountry: added common_name (vgavro)

0.6.6 (2018-01-25)

  • migrate to github/tuneinc.

  • LICENSE: MIT

0.6.2 (2017-12-09)

  • readthedocs.org

0.5.4 (2017-12-07)

  • LICENSE: LGPL 3.0

0.5.0 (2017-11-30)

  • README.rst

  • Hits and Contributors

0.3.0 (2017-11-27)

  • README.rst

  • Travis CI

0.1.9 (2017-03-12)

  • Makefile and README.rst

0.1.8 (2016-11-19)

  • Makefile and README.rst

0.1.0 (2016-11-17)

  • Initial Code

  • Code pulled from TuneLab/tune-mv-integration-python

  • Country name to Country Alpha-2 Code cleanup

0.0.1 (2016-11-17)

  • Initial commit

Release files for pycountry-convert 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycountry-convert 0.7.2
File Size Uploaded
pycountry-convert-0.7.2.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycountry-convert 0.7.2
File Interpreter ABI Platform
pycountry_convert-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / pycountry-convert-0.7.2.tar.gz

Download URL pycountry-convert-0.7.2.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
095d310f746bf2a5ef713b3a82eea28a27262286223765b1e7be8a5c4fa7e9b9
BLAKE2b-256 checksum
How to use checksums
be85a5bcf01c5e8de1b611990c723e2b88bdbfb93375e18d1539f6fa8f0f9952
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pycountry_convert-0.7.2-py3-none-any.whl

Download URL pycountry_convert-0.7.2-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e33883a88b3cb752d332ca2358ac6c4de4defc86a2b93b713b36338e914952e
BLAKE2b-256 checksum
How to use checksums
9be726c14899a43c34e04a58e3772007afe79dbd64fac15d2fbaeedff24082f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.0

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

3 release files

0.6.4

3 release files

0.6.3

3 release files

0.6.2

3 release files

0.6.1

3 release files

0.6.0

3 release files

0.5.9

3 release files

0.5.8

3 release files

0.5.7

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page