# Country Code

Key: `geography.location.country_code`

ISO 3166-1 alpha-2 country code (2 letters, e.g., US, FR, JP). Universal format.

Page: <https://meridian.online/docs/projects/finetype/types/geography/location/country_code>

Samples: `US`, `FR`, `JP`, `DE`, `CA`

## Background

### Origin

ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO).[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) ISO 3166-1 alpha-2 codes represent countries, dependent territories, and special areas of geographical interest.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) ISO 3166-1 defines three sets of country codes: alpha-2, alpha-3 and numeric.[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) The country codes have been published as ISO 3166-1 since 1997, when ISO 3166 was expanded into three parts.[[2]](https://en.wikipedia.org/wiki/ISO_3166-1)

According to the ISO 3166 Maintenance Agency (ISO 3166/MA), a new country name can enter ISO 3166-1 only by being registered in the United Nations Terminology Bulletin Country Names or in the UN Statistics Division's Country and Region Codes for Statistical Use.[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) According to the ISO 3166/MA, the codes are chosen "to reflect the significant, unique component of the country name in order to allow a visual association between country name and country code".[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) The United Kingdom is officially assigned the alpha-2 code GB rather than UK, based on its official name "United Kingdom of Great Britain and Northern Ireland".[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) Germany is assigned the alpha-2 code DE, based on its native name "Deutschland".[[2]](https://en.wikipedia.org/wiki/ISO_3166-1)

ISO 3166-1 has 249 current officially assigned alpha-2 codes.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) The alpha-2 codes AA, QM to QZ, XA to XZ, and ZZ can be user-assigned.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) The ISO 3166/MA will never use user-assigned codes when updating the standard.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) ISO 3166-1 divides its reserved alpha-2 codes into exceptional reservations, transitional reservations and indeterminate reservations.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) A country is normally assigned new ISO 3166-1 codes if it changes its name or its territorial boundaries.[[2]](https://en.wikipedia.org/wiki/ISO_3166-1) As of July 2013, ISO publishes changes to ISO 3166-1 in its online catalogue only, and no longer publishes newsletters.[[2]](https://en.wikipedia.org/wiki/ISO_3166-1)

### Use

Starting in 1985, ISO 3166-1 alpha-2 codes have been used in the Domain Name System as country code top-level domains (ccTLDs).[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) The United Kingdom, whose alpha-2 code is GB, uses .uk instead of .gb as its ccTLD.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) Treat a domain suffix as a close cousin of the alpha-2 code rather than the same thing, and map the exceptions before joining one to the other. (Meridian's view)

Eurostat's glossary of country codes lists EL as the code for Greece.[[3]](https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Country_codes) Eurostat's glossary of country codes lists UK as the code for the United Kingdom.[[3]](https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Country_codes) Eurostat's glossary of country codes lists XK as the code for Kosovo.[[3]](https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Country_codes) Eurostat's glossary notes that XK is a code used for practical reasons and not an official ISO country code.[[3]](https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Country_codes) The code XK is used by the European Commission, the IMF, SWIFT, the CLDR and other organisations as a temporary country code for Kosovo.[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) The Unicode Common Locale Data Repository (CLDR) assigns the user-assigned code ZZ to represent "Unknown or Invalid Territory".[[1]](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)

FIPS 10-4 was a list of two-letter country codes used by the U.S. Government for geographical data processing in many publications, such as the CIA World Factbook.[[4]](https://en.wikipedia.org/wiki/FIPS_10-4) FIPS 10-4 codes are similar to, but sometimes incompatible with, the ISO 3166-1 alpha-2 country codes.[[4]](https://en.wikipedia.org/wiki/FIPS_10-4) On September 2, 2008, NIST withdrew FIPS 10-4 as a Federal Information Processing Standard.[[4]](https://en.wikipedia.org/wiki/FIPS_10-4)[[5]](https://en.wikipedia.org/wiki/List_of_FIPS_country_codes) In FIPS 10-4, GM is the code for Germany.[[5]](https://en.wikipedia.org/wiki/List_of_FIPS_country_codes) In FIPS 10-4, AS is the code for Australia.[[5]](https://en.wikipedia.org/wiki/List_of_FIPS_country_codes) The UN Statistics Division's M49 table gives GM as the ISO-alpha2 code for Gambia.[[6]](https://unstats.un.org/unsd/methodology/m49/overview/) The UN Statistics Division's M49 table gives AS as the ISO-alpha2 code for American Samoa.[[6]](https://unstats.un.org/unsd/methodology/m49/overview/) The UN Statistics Division's M49 table gives AU as the ISO-alpha2 code for Australia.[[6]](https://unstats.un.org/unsd/methodology/m49/overview/) Two-letter codes that came from older US government sources deserve a spot check against a few countries you know before you trust them as ISO codes. (Meridian's view)

The UN Statistics Division's M49 table gives NA as the ISO-alpha2 code for Namibia.[[6]](https://unstats.un.org/unsd/methodology/m49/overview/) The pandas IO documentation lists 'NA' among the default values that are recognised as missing (NaN) when reading text files.[[7]](https://pandas.pydata.org/docs/user_guide/io.html) The pandas IO documentation says that specifying keep\_default\_na=False completely overrides the default values that are recognised as missing.[[7]](https://pandas.pydata.org/docs/user_guide/io.html) Read a country column as text with default missing-value detection switched off, then check that Namibia is still there. (Meridian's view)

### Where you'll meet it

The UN Statistics Division's table of standard country or area codes for statistical use (M49) publishes an ISO-alpha2 code beside each country or area's M49 code.[[6]](https://unstats.un.org/unsd/methodology/m49/overview/) GLEIF's Accepted Legal Jurisdictions Code List is based on ISO 3166 and specifies more than 300 different codes.[[8]](https://www.gleif.org/en/lei-data/code-lists/gleif-accepted-legal-jurisdictions-code-list)

## Sources

1. [ISO 3166-1 alpha-2 - Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) — secondary source
2. [ISO 3166-1 - Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1) — secondary source
3. [Glossary:Country codes - Statistics Explained - Eurostat](https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Country_codes) — organisation
4. [FIPS 10-4 - Wikipedia](https://en.wikipedia.org/wiki/FIPS_10-4) — secondary source
5. [List of FIPS country codes - Wikipedia](https://en.wikipedia.org/wiki/List_of_FIPS_country_codes) — secondary source
6. [UNSD — Methodology](https://unstats.un.org/unsd/methodology/m49/overview/) — dataset
7. [IO tools (text, CSV, HDF5, …) — pandas 3.0.6 documentation](https://pandas.pydata.org/docs/user_guide/io.html) — documentation
8. [GLEIF Accepted Legal Jurisdictions Code List - Code Lists - LEI Data – GLEIF](https://www.gleif.org/en/lei-data/code-lists/gleif-accepted-legal-jurisdictions-code-list) — organisation
