country-converter
The country converter (coco) - a Python package for converting country names between different classifications schemes
What it is and what it does
Country converter (coco) is a Python package that standardizes and matches country names across multiple classification schemes. It solves the problem of inconsistent country naming in datasets by converting between ISO 2-letter codes, ISO 3-letter codes, ISO numeric codes, and common country names. Internally, it uses regex patterns to match variants and stores data in a pandas DataFrame, making it useful for data cleaning and aggregation tasks.
The package includes built-in classifications for UN membership, EU membership, OECD membership, UN regions, continents, and various MRIO and IAM databases. It offers both a Python API and a command-line interface. For pandas Series, a dedicated `pandas_convert()` method provides significant performance gains (described as 4000x speedup for 1 million rows compared to the standard convert method). You can also access the underlying DataFrame directly to filter by membership criteria or build custom concordance matrices.
Use it for:
- Clean messy country names in datasets by converting them to standardized ISO codes or short names.
- Filter datasets by country membership in organizations like the EU, OECD, or UN by year.
- Build concordance matrices to map between different country classification schemes used in different data sources.
- Batch-convert large pandas Series of country identifiers to a target format with high performance.
- Match country names from one list against a master list using regex-based fuzzy matching.
- Extract country-level data from multi-source datasets where countries are named inconsistently.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts and matches country names across different classification standards (ISO 2/3 letter codes, numeric codes, UN/EU/OECD membership schemes) using regex-based matching and can build concordance matrices between schemes.
Yes, with conditions. The package is well-maintained enough for production use (no known vulnerabilities, active repository, supports current Python versions), but its aging maintenance status (296 days since last release) means you should monitor for updates. The GPLv3 license is a hard blocker if you need to keep your code proprietary. Install it if you regularly work with messy country data and can accept the copyleft requirement.
Install
country-converter on PyPI
pip
pip install country-converteruv
uv add country-converterpoetry
poetry add country-converterInstalling country-converter
Before you install
Low install friction with a single runtime dependency on pandas. Maintenance status is aging—the last release was 296 days ago, though the repository remains active with recent commits and no archived status.
License in practice
Licensed under GPLv3 (copyleft). Any derivative work or distribution must also be licensed under GPLv3; proprietary applications cannot incorporate this package without open-sourcing their own code.
Quickstart
pip install country_converter
import country_converter as coco
cc = coco.CountryConverter()
standard_names = cc.convert(names=['DE', 'France', 'USA'], to='name_short')
print(standard_names)
Requires Python 3.9 or later (supports 3.9–3.13); pandas must be installed as a runtime dependency.
Verify before relying
- Whether the regex-based matching handles all edge cases and non-English country name variants reliably.
- Performance characteristics for very large datasets beyond the 1 million-row example mentioned in the description.
Package facts
| License | GNU General Public License v3 (GPLv3) (copyleft) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pandas |
| Maintenance | aging — 296 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,541,161/month — #3,011 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: country_converter-1.3.2-py3-none-any.whl
Keywords: country, ISO 3166
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
pycountryProvides programmatic access to ISO standard…
copyleft · top 1,000 on PyPI
iso3166Converts between ISO 3166-1 country codes…
permissive · top 5,000 on PyPI
pycountry-convertConverts between ISO country codes (alpha-2,…
permissive · top 15,000 on PyPI
isocodesisocodes provides programmatic access to ISO…
permissive · top 15,000 on PyPI
babelfishBabelFish provides Python objects for…
permissive · top 15,000 on PyPI
hdx-python-countryMaps country and region codes and names,…
permissive · top 15,000 on PyPI
iso18245Provides lookup access to ISO 18245 Merchant…
permissive · top 15,000 on PyPI
names-datasetLooks up demographic information about first…
permissive · top 15,000 on PyPI
python-stdnumParses, validates, and reformats standard…
copyleft · top 5,000 on PyPI
cleancoCleanco strips legal suffixes (Ltd, Corp, LLC,…
permissive · top 5,000 on PyPI