skillfed

pycountry-convert

Extension of Python package pycountry providing conversion functions.

pycountry-convert v0.7.2 484.2K downloads/30d#6,405 on PyPI
Permissive license MIT License Abandoned released

What it is and what it does

pycountry-convert is an extension of the pycountry library that adds bidirectional conversion functions between country names, ISO country codes (alpha-2, alpha-3, and numeric formats), and continent codes. It uses country data derived from Wikipedia combined with pycountry's data source.

The package provides functions to map countries with customizable name formatting (default, lowercase, or uppercase), convert between any pair of country identifiers, and look up continent codes from country codes. It has no runtime dependencies beyond pycountry and pprintpp, making it lightweight to install.

Use it for:

  • Convert user-submitted country names to standardized ISO codes for database storage or API calls.
  • Determine a continent from a country code in geographic or regional analysis workflows.
  • Build lookup tables mapping country names to their ISO 3166-1 identifiers for data validation.
  • Normalize country data from multiple sources by converting between alpha-2, alpha-3, and numeric codes.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts between ISO country codes (alpha-2, alpha-3, numeric), country names, and continent codes using data from pycountry and Wikipedia.

No. The package is abandoned (last release 2018-02-18) and has not been tested against modern Python versions. While the MIT license is permissive and installation is frictionless, the lack of maintenance means country data may be stale and bugs will not be fixed. Consider using an actively maintained alternative or integrating pycountry directly with your own conversion logic.

Install

pycountry-convert on PyPI

pip

pip install pycountry-convert

uv

uv add pycountry-convert

poetry

poetry add pycountry-convert

Installing pycountry-convert

Before you install

Installation is straightforward with no compiled dependencies. However, the package has been abandoned since its latest release on 2018-02-18, so maintenance and security patches are not expected.

License in practice

Licensed under MIT (permissive), so you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install pycountry-convert

from pycountry_convert import country_alpha2_to_continent_code
continent = country_alpha2_to_continent_code('US')

Verify before relying

  • Whether the package's Wikipedia-derived country data is kept current or reflects the state as of the last 2018 release.
  • Compatibility with modern Python versions beyond 3.6, given the abandonment status and lack of recent testing.
  • Whether country data changes since 2018 affect the accuracy of conversions for current use.

Package facts

License MIT License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 3,099 days since the last release
First released
Downloads 484,175/month — #6,405 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pycountry_convert-0.7.2-py3-none-any.whl

Keywords: pycountry, conversion, tune

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.0Programming Language :: Python :: 3.1Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: Implementation :: PyPy

Tags

country code conversionISO 3166 country lookupcountry name to alpha-2 codecontinent from country codepycountry extension
country-dataiso-standards

More Utilities packages