Skip to main content

Extension of Python package pycountry providing conversion functions.

Project description

pycountry-convert

Extension of Python package pycountry providing conversion functions.

Badges

info

Documentation Status License Status Hits Contributors

tests

Travis-CI Build Status Code Coverage Status

package

PyPI Package latest release Supported versions 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.6.6 (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

Project details


Download files

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

Source Distribution

pycountry-convert-0.6.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distributions

pycountry_convert-0.6.0-py3.6.egg (20.4 kB view details)

Uploaded Source

pycountry_convert-0.6.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file pycountry-convert-0.6.0.tar.gz.

File metadata

File hashes

Hashes for pycountry-convert-0.6.0.tar.gz
Algorithm Hash digest
SHA256 5a7de92854faa427e84d266306152e5f90087d0a8012be9499f33f7b4bb0cdec
MD5 1c91ad8fae7069ddf2066d3cee650aca
BLAKE2b-256 2ef6d3d5ff8ac19e66dbfd6c2778ea2fe312d9636c2bdd723c1d081c1dc3adb5

See more details on using hashes here.

Provenance

File details

Details for the file pycountry_convert-0.6.0-py3.6.egg.

File metadata

File hashes

Hashes for pycountry_convert-0.6.0-py3.6.egg
Algorithm Hash digest
SHA256 9aae4399246700c74f6f9ba11f88e3d09f4d7c67c9517713109c341a49b66bb1
MD5 b29c11fbc73d3cca601701366288aee1
BLAKE2b-256 798021720d8fbcb5c019e547d6c2cf0445f641e8fb235057d88f5c48f130cfb7

See more details on using hashes here.

Provenance

File details

Details for the file pycountry_convert-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pycountry_convert-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fa74fdfe310988ad934f3bc3a28d7dfaabcc37904639e365d0336c350c42a35
MD5 f43543df84251b8bdd75b6af733c353b
BLAKE2b-256 ea57ded10fcd44ecdb67d9422d06986ab15a0301ad134c5f5f3288cf0ce3ce84

See more details on using hashes here.

Provenance

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