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 is to help social science research to standardize country code in multinational research. We follow ISO 3166-1 to standardize country identifiers. This list does not take any political or religious conflict into account.

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 pull request or send me email: wenzhi.ding@connect.hku.hk.

  • 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 ISO 3166-1 Numeric code and ISO 3166-1 Alpha-3 code.
  • CountryISO2: This dataset is the link table between ISO 3166-1 Alpha-2 code to ISO 3166-1 Alpha-3 code.

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

How to Use

In this way, you can always get the most updated version of country code link tables.

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

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