MCPcopy Index your code
hub / github.com/datasets/country-codes

github.com/datasets/country-codes @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
23 symbols 95 edges 19 files 3 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

badge

Description

Comprehensive country code information, including ISO 3166 codes, ITU dialing codes, ISO 4217 currency codes, and many others. Provided as a Tabular Data Package: view datapackage

Data

Data are fetched from multiple sources:

Note: CLDR shorter names "ZZ-alt-short" are used when available

Special thanks to Gwillim Law for his excellent statoids.com site (some of the field descriptions are excerpted from his site), which is more up-to-date than most similar resources and is much easier to scrape than multiple Wikipedia pages.

  • Capital cities, languages, continents, TLDs, and geonameid are from geonames.org

  • EDGAR codes are from sec.gov

  • Wikidata entity URLs (wikidata_id) are fetched via the Wikidata SPARQL endpoint using the ISO 3166-1 alpha-2 property (P297)

Preparation

This package includes Python scripts to fetch current country information from various data sources and output CSV of combined country code information.

CSV output is provided via the in2csv and csvcut utilities from csvkit

NOTE/TODO: currently, preparation requires manual process to download and rename 6 CSV files from https://unstats.un.org/unsd/methodology/m49/overview/

data/country-codes.csv

Install requirements:

pip install -r scripts/requirements.txt

Run GNU Make to generate data file:

make update
#then
make clean

License

This material is licensed by its maintainers under the Public Domain Dedication and License.

Nevertheless, it should be noted that this material is ultimately sourced from ISO and other standards bodies and their rights and licensing policies are somewhat unclear. As this is a short, simple database of facts there is a strong argument that no rights can subsist in this collection. However, ISO state on their site:

ISO makes the list of alpha-2 country codes available for internal use and non-commercial purposes free of charge.

This carries the implication (though not spelled out) that other uses are not permitted and that, therefore, there may be rights preventing further general use and reuse.

If you intended to use these data in a public or commercial product, please check the original sources for any specific restrictions.

Core symbols most depended-on inside this repo

Shape

Function 23

Languages

Python100%

Modules by API surface

scripts/statoids.py3 symbols
scripts/iso4217.py2 symbols
scripts/geoname.py2 symbols
scripts/flatten.py2 symbols
scripts/fifa.py2 symbols
scripts/corrections.py2 symbols
scripts/cleanup.py2 symbols
scripts/wd_countries.py1 symbols
scripts/utils.py1 symbols
scripts/unterm_names.py1 symbols
scripts/reorder_rows.py1 symbols
scripts/join_unterm.py1 symbols

For agents

$ claude mcp add country-codes \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page