Skip to content

This repo contains a bunch of link tables that help to standardize country code.

License

Notifications You must be signed in to change notification settings

Wenzhi-Ding/Std_Country_Code

Repository files navigation

Standardize Country Code

This project helps social science research standardize country codes in multinational research. We follow ISO 3166-1 to standardize country identifiers. This list does not take any political or religious conflict into account.

Just in case you are interested in similar data tools, I also constructed:

Please star the projects if you feel it is useful! Many thanks for your appreciation and support!

The list is now cross-sectional, and I would like to develop it into a panel.

Please feel free to contribute if you find any uncovered or wrong country name/number/code. You can either use a pull request or email me at [email protected].

  • CountryName: This dataset is the link table between country names and ISO 3166-1 Alpha-3 code.
  • CountryNumber: This dataset is the link table between the ISO 3166-1 Numeric code and ISO 3166-1 Alpha-3 code.
  • CountryISO2: This dataset is the link table between the ISO 3166-1 Alpha-2 code and ISO 3166-1 Alpha-3 code.

P.S. I have made some personal adjustments to keep the keys unique in each table. For example, Zaire and Congo share the numeric code 180 but with different alpha codes (ZR, ZAR, CD, COD). I only keep the present regime (180, CD, COD).

How to Use

You can get the most updated country code link table version in the following ways:

Python

import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/Wenzhi-Ding/StdCountryCode/main/CountryName.csv', encoding='utf-8')  # Please use UTF-8 encoding.

Stata

import delimited "https://raw.githubusercontent.com/Wenzhi-Ding/StdCountryCode/main/CountryName.csv", clear

rename (Ctry_Name Ctry_ISO3) ([your country name] [your country code])

save "${some_path}CountryName.dta", replace

Table of Content

Main tables:

  • CountryName.csv: Country name map to 3-digit ISO code.
  • CountryISO2.csv: Country 2-digit ISO code map to 3-digit ISO code.
  • CountryNumber.csv: Country number map to 3-digit ISO code.

Other useful tables:

  • DSCurrency.csv: Datastream currency code map to standard currency code.
  • CN_ProvinceName.csv: China province name map to standard code.
  • US_StateName.csv: US state name map to standard abbreviation.

References

  1. Country Codes Collection (iso.org)
  2. Country Codes (worldbank.org)
  3. ISO 3166-3 - Wikipedia

About

This repo contains a bunch of link tables that help to standardize country code.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published