Skip to content

Instantly share code, notes, and snippets.

@mok0
Created March 21, 2020 23:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mok0/933578535d9cd4dddb93a1f7d9ead2e5 to your computer and use it in GitHub Desktop.
Save mok0/933578535d9cd4dddb93a1f7d9ead2e5 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# pylint: disable=C0326
# ISO-3166 alpha2, alpha3 and numerical codes ("nisos"). Negative
# nisos are not defined officially, here they are used to create
# compatibility with SB statistics, which includes now defunct
# countries. The ISO definition is used whenever possible.
iso3166 = {
"Afghanistan": ["AF", "AFG", 4],
"Åland Islands": ["AX", "ALA", 248],
"Albania": ["AL", "ALB", 8],
"Algeria": ["DZ", "DZA", 12],
"American Samoa": ["AS", "ASM", 16],
"Andorra": ["AD", "AND", 20],
"Angola": ["AO", "AGO", 24],
"Anguilla": ["AI", "AIA", 660],
"Antarctica": ["AQ", "ATA", 10],
"Antigua and Barbuda": ["AG", "ATG", 28],
"Argentina": ["AR", "ARG", 32],
"Armenia": ["AM", "ARM", 51],
"Aruba": ["AW", "ABW", 533],
"Australia": ["AU", "AUS", 36],
"Austria": ["AT", "AUT", 40],
"Azerbaijan": ["AZ", "AZE", 31],
"Bahamas": ["BS", "BHS", 44],
"The Bahamas": ["BS", "BHS", 44],
"Bahamas, The": ["BS", "BHS", 44],
"Bahrain": ["BH", "BHR", 48],
"Bangladesh": ["BD", "BGD", 50],
"Barbados": ["BB", "BRB", 52],
"Belarus": ["BY", "BLR", 112],
"Belgium": ["BE", "BEL", 56],
"Belize": ["BZ", "BLZ", 84],
"Benin": ["BJ", "BEN", 204],
"Bermuda": ["BM", "BMU", 60],
"Bhutan": ["BT", "BTN", 64],
"Bolivia, Plurinational State of": ["BO", "BOL", 68],
"Bonaire, Sint Eustatius and Saba": ["BQ", "BES", 535],
"Bosnia and Herzegovina": ["BA", "BIH", 70],
"Botswana": ["BW", "BWA", 72],
"Bouvet Island": ["BV", "BVT", 74],
"Brazil": ["BR", "BRA", 76],
"British Indian Ocean Territory": ["IO", "IOT", 86],
"Brunei Darussalam": ["BN", "BRN", 96],
"Brunei": ["BN", "BRN", 96],
"Bulgaria": ["BG", "BGR", 100],
"Burkina Faso": ["BF", "BFA", 854],
"Burundi": ["BI", "BDI", 108],
"Cambodia": ["KH", "KHM", 116],
"Cameroon": ["CM", "CMR", 120],
"Canada": ["CA", "CAN", 124],
"Cape Verde": ["CV", "CPV", 132],
"Cabo Verde": ["CV", "CPV", 132],
"Cayman Islands": ["KY", "CYM", 136],
"Central African Republic": ["CF", "CAF", 140],
"Chad": ["TD", "TCD", 148],
"Chile": ["CL", "CHL", 152],
"China": ["CN", "CHN", 156],
"Mainland China": ["CN", "CHN", 156],
"Christmas Island": ["CX", "CXR", 162],
"Cocos (Keeling) Islands": ["CC", "CCK", 166],
"Colombia": ["CO", "COL", 170],
"Comoros": ["KM", "COM", 174],
"Congo, Republic of the": ["CG", "COG", 178],
"Republic of the Congo": ["CG", "COG", 178],
"Congo (Brazzaville)": ["CG", "COG", 178],
"Congo, the Democratic Republic of the": ["CD", "COD", 180],
"Congo (Kinshasa)": ["CD", "COD", 180],
"Cook Islands": ["CK", "COK", 184],
"Costa Rica": ["CR", "CRI", 188],
"Côte d'Ivoire": ["CI", "CIV", 384],
"Cote d'Ivoire": ["CI", "CIV", 384],
"Ivory Coast": ["CI", "CIV", 384],
"Croatia": ["HR", "HRV", 191],
"Cuba": ["CU", "CUB", 192],
"Curaçao": ["CW", "CUW", 531],
"Curacao": ["CW", "CUW", 531],
"Cyprus": ["CY", "CYP", 196],
"Czech Republic": ["CZ", "CZE", 203],
"Czechia": ["CZ", "CZE", 203],
"Denmark": ["DK", "DNK", 208],
"Djibouti": ["DJ", "DJI", 262],
"Dominica": ["DM", "DMA", 212],
"Dominican Republic": ["DO", "DOM", 214],
"Ecuador": ["EC", "ECU", 218],
"Egypt": ["EG", "EGY", 818],
"El Salvador": ["SV", "SLV", 222],
"Equatorial Guinea": ["GQ", "GNQ", 226],
"Eritrea": ["ER", "ERI", 232],
"Estonia": ["EE", "EST", 233],
"Ethiopia": ["ET", "ETH", 231],
"Falkland Islands": ["FK", "FLK", 238],
"Faroe Islands": ["FO", "FRO", 234],
"Fiji": ["FJ", "FJI", 242],
"Finland": ["FI", "FIN", 246],
"France, Metropolitan": ["FX","fx",249],
"France": ["FR", "FRA", 250],
"French Guiana": ["GF", "GUF", 254],
"French Polynesia": ["PF", "PYF", 258],
"French Southern Territories": ["TF", "ATF", 260],
"Gabon": ["GA", "GAB", 266],
"Gambia": ["GM", "GMB", 270],
"Gambia, The": ["GM", "GMB", 270],
"The Gambia": ["GM", "GMB", 270],
"Georgia": ["GE", "GEO", 268],
"Germany": ["DE", "DEU", 276],
"Ghana": ["GH", "GHA", 288],
"Gibraltar": ["GI", "GIB", 292],
"Greece": ["GR", "GRC", 300],
"Greenland": ["GL", "GRL", 304],
"Grenada": ["GD", "GRD", 308],
"Guadeloupe": ["GP", "GLP", 312],
"Guam": ["GU", "GUM", 316],
"Guatemala": ["GT", "GTM", 320],
"Guernsey": ["GG", "GGY", 831],
"Guinea": ["GN", "GIN", 324],
"Guinea-Bissau": ["GW", "GNB", 624],
"Guyana": ["GY", "GUY", 328],
"Haiti": ["HT", "HTI", 332],
"Heard Island and McDonald Islands": ["HM", "HMD", 334],
"Vatican City State": ["VA", "VAT", 336],
"Vatican City": ["VA", "VAT", 336],
"Holy See": ["VA", "VAT", 336],
"Honduras": ["HN", "HND", 340],
"Hong Kong": ["HK", "HKG", 344],
"Hong Kong SAR": ["HK", "HKG", 344],
"Hungary": ["HU", "HUN", 348],
"Iceland": ["IS", "ISL", 352],
"India": ["IN", "IND", 356],
"Indonesia": ["ID", "IDN", 360],
"Iran, Islamic Republic of": ["IR", "IRN", 364],
"Iran (Islamic Republic of)": ["IR", "IRN", 364],
"Iraq": ["IQ", "IRQ", 368],
"Ireland": ["IE", "IRL", 372],
"Republic of Ireland": ["IE", "IRL", 372],
"Isle of Man": ["IM", "IMN", 833],
"Israel": ["IL", "ISR", 376],
"Italy": ["IT", "ITA", 380],
"Jamaica": ["JM", "JAM", 388],
"Japan": ["JP", "JPN", 392],
"Jersey": ["JE", "JEY", 832],
"Jordan": ["JO", "JOR", 400],
"Kazakhstan": ["KZ", "KAZ", 398],
"Kenya": ["KE", "KEN", 404],
"Kiribati": ["KI", "KIR", 296],
"Korea, Democratic People's Republic of": ["KP", "PRK", 408],
"Korea, Republic of": ["KR", "KOR", 410],
"Republic of Korea": ["KR", "KOR", 410],
"Korea, South": ["KR", "KOR", 410],
"Kuwait": ["KW", "KWT", 414],
"Kyrgyzstan": ["KG", "KGZ", 417],
"Lao People's Democratic Republic": ["LA", "LAO", 418],
"Latvia": ["LV", "LVA", 428],
"Lebanon": ["LB", "LBN", 422],
"Lesotho": ["LS", "LSO", 426],
"Liberia": ["LR", "LBR", 430],
"Libya": ["LY", "LBY", 434],
"Liechtenstein": ["LI", "LIE", 438],
"Lithuania": ["LT", "LTU", 440],
"Luxembourg": ["LU", "LUX", 442],
"Macao": ["MO", "MAC", 446],
"Macau": ["MO", "MAC", 446],
"Macao SAR": ["MO", "MAC", 446],
"Macedonia, Republic of": ["MK", "MKD", 807],
"North Macedonia": ["MK", "MKD", 807],
"Madagascar": ["MG", "MDG", 450],
"Malawi": ["MW", "MWI", 454],
"Malaysia": ["MY", "MYS", 458],
"Maldives": ["MV", "MDV", 462],
"Mali": ["ML", "MLI", 466],
"Malta": ["MT", "MLT", 470],
"Marshall Islands": ["MH", "MHL", 584],
"Martinique": ["MQ", "MTQ", 474],
"Mauritania": ["MR", "MRT", 478],
"Mauritius": ["MU", "MUS", 480],
"Mayotte": ["YT", "MYT", 175],
"Mexico": ["MX", "MEX", 484],
"Micronesia, Federated States of": ["FM", "FSM", 583],
"Moldova, Republic of": ["MD", "MDA", 498],
"Republic of Moldova": ["MD", "MDA", 498],
"Monaco": ["MC", "MCO", 492],
"Mongolia": ["MN", "MNG", 496],
"Montenegro": ["ME", "MNE", 499],
"Montserrat": ["MS", "MSR", 500],
"Morocco": ["MA", "MAR", 504],
"Mozambique": ["MZ", "MOZ", 508],
"Myanmar": ["MM", "MMR", 104],
"Namibia": ["NA", "NAM", 516],
"Nauru": ["NR", "NRU", 520],
"Nepal": ["NP", "NPL", 524],
"Netherlands": ["NL", "NLD", 528],
"New Caledonia": ["NC", "NCL", 540],
"New Zealand": ["NZ", "NZL", 554],
"Nicaragua": ["NI", "NIC", 558],
"Niger": ["NE", "NER", 562],
"Nigeria": ["NG", "NGA", 566],
"Niue": ["NU", "NIU", 570],
"Norfolk Island": ["NF", "NFK", 574],
"Northern Mariana Islands": ["MP", "MNP", 580],
"Norway": ["NO", "NOR", 578],
"Oman": ["OM", "OMN", 512],
"Pakistan": ["PK", "PAK", 586],
"Palau": ["PW", "PLW", 585],
"Palestine, State of": ["PS", "PSE", 275],
"Palestine": ["PS", "PSE", 275],
"occupied Palestinian territory": ["PS", "PSE", 275],
"Panama": ["PA", "PAN", 591],
"Papua New Guinea": ["PG", "PNG", 598],
"Paraguay": ["PY", "PRY", 600],
"Peru": ["PE", "PER", 604],
"Philippines": ["PH", "PHL", 608],
"Pitcairn": ["PN", "PCN", 612],
"Poland": ["PL", "POL", 616],
"Portugal": ["PT", "PRT", 620],
"Puerto Rico": ["PR", "PRI", 630],
"Qatar": ["QA", "QAT", 634],
"Réunion": ["RE", "REU", 638],
"Reunion": ["RE", "REU", 638],
"Romania": ["RO", "ROU", 642],
"Russian Federation": ["RU", "RUS", 643],
"Rwanda": ["RW", "RWA", 646],
"Saint Barthélemy": ["BL", "BLM", 652],
"Saint Barthelemy": ["BL", "BLM", 652],
"Saint Helena, Ascension and Tristan da Cunha": ["SH", "SHN", 654],
"Saint Kitts and Nevis": ["KN", "KNA", 659],
"Saint Lucia": ["LC", "LCA", 662],
"Saint Martin (French part)": ["MF", "MAF", 663],
"St. Martin": ["MF", "MAF", 663],
"Saint Martin": ["MF", "MAF", 663],
"Saint Pierre and Miquelon": ["PM", "SPM", 666],
"Saint Vincent and the Grenadines": ["VC", "VCT", 670],
"Samoa": ["WS", "WSM", 882],
"San Marino": ["SM", "SMR", 674],
"Sao Tome and Principe": ["ST", "STP", 678],
"Saudi Arabia": ["SA", "SAU", 682],
"Senegal": ["SN", "SEN", 686],
"Serbia": ["RS", "SRB", 688],
"Seychelles": ["SC", "SYC", 690],
"Sierra Leone": ["SL", "SLE", 694],
"Singapore": ["SG", "SGP", 702],
"Sint Maarten (Dutch part)": ["SX", "SXM", 534],
"Slovakia": ["SK", "SVK", 703],
"Slovenia": ["SI", "SVN", 705],
"Solomon Islands": ["SB", "SLB", 90],
"Somalia": ["SO", "SOM", 706],
"South Africa": ["ZA", "ZAF", 710],
"South Georgia and the South Sandwich Islands": ["GS", "SGS", 239],
"South Sudan": ["SS", "SSD", 728],
"Spain": ["ES", "ESP", 724],
"Sri Lanka": ["LK", "LKA", 144],
"Sudan": ["SD", "SDN", 729],
"Sudan (before 2011)": ["SD","SDN",736], # Divided -> Sudan and South Sudan
"Suriname": ["SR", "SUR", 740],
"Svalbard and Jan Mayen": ["SJ", "SJM", 744],
"Swaziland": ["SZ", "SWZ", 748],
"Eswatini": ["SZ", "SWZ", 748],
"Sweden": ["SE", "SWE", 752],
"Switzerland": ["CH", "CHE", 756],
"Syrian Arab Republic": ["SY", "SYR", 760],
"Taiwan": ["TW", "TWN", 158],
"Taiwan*": ["TW", "TWN", 158],
"Taipei and environs": ["TW", "TWN", 158],
"Tajikistan": ["TJ", "TJK", 762],
"Tanzania, United Republic of": ["TZ", "TZA", 834],
"Tanzania": ["TZ", "TZA", 834],
"Thailand": ["TH", "THA", 764],
"Timor-Leste": ["TL", "TLS", 626],
"Togo": ["TG", "TGO", 768],
"Tokelau": ["TK", "TKL", 772],
"Tonga": ["TO", "TON", 776],
"Trinidad and Tobago": ["TT", "TTO", 780],
"Tunisia": ["TN", "TUN", 788],
"Turkey": ["TR", "TUR", 792],
"Turkmenistan": ["TM", "TKM", 795],
"Turks and Caicos Islands": ["TC", "TCA", 796],
"Tuvalu": ["TV", "TUV", 798],
"Uganda": ["UG", "UGA", 800],
"Ukraine": ["UA", "UKR", 804],
"United Arab Emirates": ["AE", "ARE", 784],
"United Kingdom": ["GB", "GBR", 826],
"UK": ["GB", "GBR", 826],
"US": ["US", "USA", 840],
"United States of America": ["US", "USA", 840],
"United States Minor Outlying Islands": ["UM", "UMI", 581],
"Uruguay": ["UY", "URY", 858],
"Uzbekistan": ["UZ", "UZB", 860],
"Vanuatu": ["VU", "VUT", 548],
"Venezuela, Bolivarian Republic of": ["VE", "VEN", 862],
"Viet Nam": ["VN", "VNM", 704],
"Vietnam": ["VN", "VNM", 704],
"Virgin Islands, British": ["VG", "VGB", 92],
"Virgin Islands, U.S.": ["VI", "VIR", 850],
"Wallis and Futuna": ["WF", "WLF", 876],
"Western Sahara": ["EH", "ESH", 732],
"Yemen": ["YE", "YEM", 887], # (i.e. North + South Yemen)
"Yemen, Arab Republic": ["YE", "YEM", 886], # (i.e. North Yemen)
"Zambia": ["ZM", "ZMB", 894],
"Zimbabwe": ["ZW", "ZWE", 716],
# Entries added by me
'Netherlands Antilles': ["AN","ANT",530],
'German Democratic Republic': ["DD","DDR", 278],
'Serbia and Montenegro': ["CS","SCG",-9], # 2003-2006 (891)
'Yugoslavia': ["YU","YUG",890], # Until 1993
'Yugoslavia, Federal Republic of': ["YU","YUG",891], # 1993-2003
'Czechoslovakia':["CS","CSK",200],
'Sikkim':["SK","SKM",698],
'Gaza':["GZ","", 274],
# dummy entries for no longer existing countries
'Stateless':["", "nst", -2],
'Middle East not stated':["","mid", -3],
'French West Indies':["","fwi",-4],
'South-West Africa':["","swa",-5],
'Northern Ireland': ["","NIR", -6],
'North Ireland': ["","NIR", -6],
'Trucial Oman': ["","tom", -7],
'Unknown': ["","unk", -99],
'Dubai': ["","dub", -8],
'Abu Dhabi': ["","abu", -50],
##'Kosovo':["XK","XKO",983], use KSV from WB
'Soviet Union':["SU","SUN",810],
'Yemen, Democratic Republic':["YD","YMD",720], # (i.e., South Yemen)
# Area entries added from UN definition.
"WORLD": ["","WLD",900],
'AFRICA': ["","af",903],
'LATIN AMERICA AND THE CARIBBEAN': ["","amlc",904],
'NORTHERN AMERICA': ["","NAC",905],
'EASTERN ASIA': ["","ase",906],
'EUROPE': ["","e",908],
'OCEANIA': ["","oc",909],
'EASTERN AFRICA': ["","afe",910],
'MIDDLE AFRICA': ["","afm",911],
'NORTHERN AFRICA': ["","afn",912],
'SOUTHERN AFRICA': ["","afs",913],
'WESTERN AFRICA': ["","afw",914],
'CARIBBEAN': ["","CSS",915], # World Bank Carribean Small States
'CENTRAL AMERICA': ["","amc",916],
'SOUTH-EASTERN ASIA': ["","asse",920],
'SOUTH-CENTRAL ASIA': ["","assc",921],
"WESTERN ASIA": ["","asw",922],
'EASTERN EUROPE': ["","ee",923],
'NORTHERN EUROPE': ["","en",924],
'SOUTHERN EUROPE': ["","es",925],
'WESTERN EUROPE': ["","ew",926],
'AUSTRALIA/NEW ZEALAND': ["","oca",927],
'MELANESIA': ["","ocm",928],
'SOUTH AMERICA': ["","ams",931],
'MORE DEVELOPED REGIONS': ["","mdr",901],
'LESS DEVELOPED REGIONS': ["","ldr",902],
'LESS DEVELOPED REGIONS (excluding least developed countries)': ["","ldr2",934],
'ASIA': ["","as",935],
'LEAST DEVELOPED COUNTRIES': ["","LDC",941],
'SUB-SAHARAN AFRICA': ["","SSF",947],
'LESS DEVELOPED REGIONS (excluding China)': ["","ldr3",948],
'MICRONESIA': ["","MIC",954],
'POLYNESIA': ["","pol",957],
'CENTRAL ASIA': ["","asc",5500],
# World Bank classification
'Channel Islands': ["","CHI", 830],
'Kosovo':["","KSV",983],
'ARAB WORLD': ["","ARB",-10],
'EAST ASIA AND PACIFIC': ['','EAS', -11],
'EAST ASIA & PACIFIC (developing only)': ['','EAP',-12],
'EURO AREA': ['','EMU', -13],
'EUROPE & CENTRAL ASIA': ['','ECS',-14],
'EUROPE & CENTRAL ASIA (developing only)': ['','ECA',-15],
'EUROPEAN UNION': ['','EUU', -16],
'HEAVILY INDEBTED POOR COUNTRIES (HIPC)': ['','HPC',-17],
'HIGH INCOME': ['','HIC',-18],
'HIGH INCOME: nonOECD': ['','NOC',-19],
'HIGH INCOME: OECD': ['','OEC',-20],
'LATIN AMERICA & CARIBBEAN': ['','LCN',-21],
'LATIN AMERICA & CARIBBEAN (developing only)': ['','LAC',-22],
'LOW & MIDDLE INCOME': ['','LMY',-24],
'LOW INCOME': ['','LIC',-25],
'LOWER MIDDLE INCOME': ['','LMC',-26],
'MIDDLE EAST & NORTH AFRICA': ['','MEA',-27],
'MIDDLE EAST & NORTH AFRICA (developing only)': ['','MNA',-28],
'MIDDLE INCOME': ['','MIC',-29],
'NORTH AMERICA': ['','NAC',905],
'Not classified': ['','INX',-31],
'OECD MEMBERS': ['','OED',-32],
'OTHER SMALL STATES': ['','OSS',-33],
'PACIFIC ISLAND SMALL STATES': ['','PSS',-34],
'SMALL STATES': ['','SST',-35],
'SOUTH ASIA': ['','SAS',5501],
'SUB-SAHARAN AFRICA (developing only)': ['','SSA',-38],
'UPPER MIDDLE INCOME': ['','UMC',-39],
'CENTRAL EUROPE AND THE BALTICS':['','CEB',-40],
'FRAGILE AND CONFLICT AFFECTED SITUATIONS':['','FCS',-41],
'AMERICA':['','ame',-51],
'ATLANTIC':['','alt',-52],
'ATLANTIC NORTHERN':['','aln', -53],
'ATLANTIC SOUTHERN': ['','als',-54],
'INDIAN OCEAN SOUTH': ['','ios',-55],
'MIDDLE EAST': ['','mde',-56],
'OCEANIA MISC': ['','omi',-57],
'WESTERN': ['','wes',-58],
'Cruise Ship': ['','',-100],
'Others': ['','',-101],
}
niso_to_short_name = {
68: 'Bolivia',
364: 'Iran',
408: 'North Korea',
410: 'South Korea',
418: 'Laos',
498: 'Moldova',
583: 'Micronesia',
643: 'Russia',
760: 'Syria',
807: 'Macedonia',
862: 'Venezuela',
}
short_name_to_niso = dict([[v,k] for k,v in niso_to_short_name.items()])
c3_to_niso = {}
niso_to_name = {}
name_to_niso = {}
niso_to_c3 = {}
for c,v in iso3166.items():
c3_to_niso[v[1]] = v[2]
niso_to_name[v[2]] = c
name_to_niso[c] = v[2]
niso_to_c3[v[2]] = v[1]
#.
# Override some of the silly long names
niso_to_name.update(niso_to_short_name)
name_to_niso.update(short_name_to_niso)
# Utility function useful for debugging in iPython
def names(L):
for i in L:
print("{:4d} {}".format(i, niso_to_name[i]))
#.
#.
if __name__ == "__main__":
for c,v in iso3166.items():
print("{:45s} {:03d}".format(c,v[2]))
#.
#.
# Province names in the CSSE COVID-19 database
# I have assigned the ids
nprov_to_name = {
-99: 'None',
-100: 'Diamond Princess Cruise Ship',
-102: 'Grand Princess Cruise Ship',
4: 'Australian Capital Territory',
6: 'New South Wales',
7: 'Northern Territory',
8: 'Queensland',
9: 'South Australia',
10: 'Tasmania',
11: 'Victoria',
12: 'Western Australia',
14: 'Montreal, QC',
15: 'Alberta',
16: 'British Columbia',
17: 'Calgary, Alberta',
18: 'Edmonton, Alberta',
20: 'London, ON',
21: 'Manitoba',
22: 'New Brunswick',
23: 'Newfoundland and Labrador',
24: 'Nova Scotia',
25: 'Ontario',
26: 'Prince Edward Island',
27: 'Quebec',
28: 'Saskatchewan',
29: 'Toronto, ON',
30: 'Anhui',
31: 'Beijing',
32: 'Chongqing',
33: 'Fujian',
34: 'Gansu',
35: 'Guangdong',
36: 'Guangxi',
37: 'Guizhou',
38: 'Hainan',
39: 'Hebei',
40: 'Heilongjiang',
41: 'Henan',
42: 'Hong Kong',
43: 'Hubei',
44: 'Hunan',
45: 'Inner Mongolia',
46: 'Jiangsu',
47: 'Jiangxi',
48: 'Jilin',
49: 'Liaoning',
50: 'Macau',
51: 'Ningxia',
52: 'Qinghai',
53: 'Shaanxi',
54: 'Shandong',
55: 'Shanghai',
56: 'Shanxi',
57: 'Sichuan',
58: 'Tianjin',
59: 'Tibet',
60: 'Xinjiang',
61: 'Yunnan',
62: 'Zhejiang',
63: 'Taiwan',
64: 'Denmark',
65: 'Faroe Islands',
66: 'Greenland',
67: 'French Guiana',
68: 'France',
70: 'French Polynesia',
71: 'Guadeloupe',
72: 'Mayotte',
73: 'New Caledonia',
74: 'Reunion',
75: 'Saint Barthelemy',
76: 'St Martin',
77: 'Bavaria',
78: 'Hong Kong',
82: 'Macau',
83: 'Aruba',
84: 'Curacao',
85: 'Netherlands',
86: 'Sint Maarten',
87: 'Bermuda',
88: 'Cayman Islands',
89: 'Channel Islands',
90: 'Gibraltar',
91: 'Isle of Man',
92: 'Montserrat',
93: 'UK',
94: 'United Kingdom',
95: 'Norfolk County, MA',
96: 'Alabama',
97: 'Alameda County, CA',
98: 'Alaska',
99: 'Arizona',
100: 'Arkansas',
101: 'Ashland, NE',
102: 'Bennington County, VT',
103: 'Bergen County, NJ',
104: 'Berkeley, CA',
105: 'Berkshire County, MA',
106: 'Boston, MA',
107: 'Broward County, FL',
108: 'California',
109: 'Carver County, MN',
110: 'Charleston County, SC',
111: 'Charlotte County, FL',
112: 'Chatham County, NC',
113: 'Cherokee County, GA',
115: 'Chicago, IL',
116: 'Clark County, NV',
117: 'Clark County, WA',
118: 'Cobb County, GA',
119: 'Collin County, TX',
120: 'Colorado',
121: 'Connecticut',
122: 'Contra Costa County, CA',
123: 'Cook County, IL',
124: 'Davidson County, TN',
125: 'Davis County, UT',
126: 'Delaware',
127: 'Delaware County, PA',
128: 'Denver County, CO',
130: 'District of Columbia',
131: 'Douglas County, CO',
132: 'Douglas County, NE',
133: 'Douglas County, OR',
134: 'El Paso County, CO',
135: 'Fairfax County, VA',
136: 'Fairfield County, CT',
137: 'Fayette County, KY',
138: 'Florida',
139: 'Floyd County, GA',
140: 'Fort Bend County, TX',
141: 'Fresno County, CA',
142: 'Fulton County, GA',
143: 'Georgia',
144: 'Grafton County, NH',
147: 'Grant County, WA',
148: 'Guam',
149: 'Harford County, MD',
150: 'Harris County, TX',
151: 'Harrison County, KY',
152: 'Hawaii',
153: 'Hendricks County, IN',
154: 'Hillsborough, FL',
155: 'Honolulu County, HI',
156: 'Hudson County, NJ',
157: 'Humboldt County, CA',
158: 'Idaho',
159: 'Illinois',
160: 'Indiana',
161: 'Iowa',
162: 'Jackson County, OR',
163: 'Jefferson County, KY',
164: 'Jefferson County, WA',
165: 'Jefferson Parish, LA',
166: 'Johnson County, IA',
167: 'Johnson County, KS',
168: 'Kansas',
169: 'Kentucky',
170: 'Kershaw County, SC',
171: 'King County, WA',
172: 'Kittitas County, WA',
173: 'Klamath County, OR',
174: 'Lackland, TX',
176: 'Lee County, FL',
177: 'Los Angeles, CA',
178: 'Louisiana',
179: 'Madera County, CA',
180: 'Madison, WI',
181: 'Maine',
182: 'Manatee County, FL',
183: 'Maricopa County, AZ',
184: 'Marion County, IN',
185: 'Marion County, OR',
186: 'Maryland',
187: 'Massachusetts',
188: 'Michigan',
189: 'Middlesex County, MA',
190: 'Minnesota',
191: 'Mississippi',
192: 'Missouri',
193: 'Montana',
194: 'Montgomery County, MD',
195: 'Montgomery County, PA',
196: 'Montgomery County, TX',
197: 'Nassau County, NY',
198: 'Nebraska',
199: 'Nevada',
200: 'New Hampshire',
201: 'New Jersey',
202: 'New Mexico',
203: 'New York',
204: 'New York City, NY',
205: 'New York County, NY',
206: 'Norfolk County, MA',
207: 'North Carolina',
208: 'North Dakota',
209: 'Norwell County, MA',
210: 'Ohio',
211: 'Okaloosa County, FL',
212: 'Oklahoma',
214: 'Orange County, CA',
215: 'Orange, CA',
216: 'Oregon',
217: 'Pennsylvania',
218: 'Pierce County, WA',
219: 'Pinal County, AZ',
220: 'Placer County, CA',
221: 'Plymouth County, MA',
222: 'Polk County, GA',
223: 'Portland, OR',
224: 'Providence County, RI',
225: 'Providence, RI',
226: 'Puerto Rico',
227: 'Queens County, NY',
228: 'Ramsey County, MN',
229: 'Rhode Island',
230: 'Riverside County, CA',
231: 'Rockingham County, NH',
232: 'Rockland County, NY',
233: 'Sacramento County, CA',
234: 'San Antonio, TX',
235: 'San Benito, CA',
236: 'San Diego County, CA',
237: 'San Francisco County, CA',
238: 'San Mateo, CA',
239: 'Santa Clara County, CA',
240: 'Santa Clara, CA',
241: 'Santa Cruz County, CA',
242: 'Santa Rosa County, FL',
243: 'Sarasota, FL',
244: 'Saratoga County, NY',
245: 'Seattle, WA',
246: 'Shasta County, CA',
247: 'Shelby County, TN',
248: 'Snohomish County, WA',
249: 'Sonoma County, CA',
250: 'South Carolina',
251: 'South Dakota',
252: 'Spartanburg County, SC',
253: 'Spokane County, WA',
254: 'St. Louis County, MO',
255: 'Suffolk County, MA',
256: 'Suffolk County, NY',
257: 'Summit County, CO',
258: 'Tempe, AZ',
259: 'Tennessee',
260: 'Texas',
261: 'Travis, CA',
263: 'Tulsa County, OK',
264: 'US',
265: 'Ulster County, NY',
266: 'Umatilla, OR',
268: 'Vermont',
279: 'Washington',
270: 'Virgin Islands, U.S.',
271: 'Unknown Location, MA',
272: 'Utah',
276: 'Virginia',
277: 'Volusia County, FL',
278: 'Wake County, NC',
280: 'Washington County, OR',
281: 'Washington, D.C.',
282: 'Washoe County, NV',
283: 'Wayne County, PA',
284: 'West Virginia',
285: 'Westchester County, NY',
286: 'Williamson County, TN',
287: 'Wisconsin',
288: 'Wyoming',
289: 'Yolo County, CA'
}
name_to_nprov = {
'Cruise Ship': -100,
'Diamond Princess cruise ship': -100,
'Diamond Princess': -100,
'Australian Capital Territory': 4,
'From Diamond Princess': -100,
'New South Wales': 6,
'Northern Territory': 7,
'Queensland': 8,
'South Australia': 9,
'Tasmania': 10,
'Victoria': 11,
'Western Australia': 12,
'None': -99,
'Montreal, QC': 14,
'Alberta': 15,
'British Columbia': 16,
'Calgary, Alberta': 17,
'Edmonton, Alberta': 18,
'Grand Princess': -102,
'London, ON': 20,
'Manitoba': 21,
'New Brunswick': 22,
'Newfoundland and Labrador': 23,
'Nova Scotia': 24,
'Ontario': 25,
'Prince Edward Island': 26,
'Quebec': 27,
'Saskatchewan': 28,
'Toronto, ON': 29,
'Anhui': 30,
'Beijing': 31,
'Chongqing': 32,
'Fujian': 33,
'Gansu': 34,
'Guangdong': 35,
'Guangxi': 36,
'Guizhou': 37,
'Hainan': 38,
'Hebei': 39,
'Heilongjiang': 40,
'Henan': 41,
'Hong Kong': 78,
'Hubei': 43,
'Hunan': 44,
'Inner Mongolia': 45,
'Jiangsu': 46,
'Jiangxi': 47,
'Jilin': 48,
'Liaoning': 49,
'Macau': 82,
'Ningxia': 51,
'Qinghai': 52,
'Shaanxi': 53,
'Shandong': 54,
'Shanghai': 55,
'Shanxi': 56,
'Sichuan': 57,
'Tianjin': 58,
'Tibet': 59,
'Xinjiang': 60,
'Yunnan': 61,
'Zhejiang': 62,
'Taiwan': 63,
'Denmark': 64,
'Faroe Islands': 65,
'Greenland': 66,
'Fench Guiana': 67,
'France': 68,
'French Guiana': 67,
'French Polynesia': 70,
'Guadeloupe': 71,
'Mayotte': 72,
'New Caledonia': 73,
'Reunion': 74,
'Saint Barthelemy': 75,
'St Martin': 76,
'Bavaria': 77,
'Aruba': 83,
'Curacao': 84,
'Netherlands': 85,
'Sint Maarten': 86,
'Bermuda': 87,
'Cayman Islands': 88,
'Channel Islands': 89,
'Gibraltar': 90,
'Isle of Man': 91,
'Montserrat': 92,
'UK': 93,
'United Kingdom': 94,
'Norfolk County, MA': 206,
'Alabama': 96,
'Alameda County, CA': 97,
'Alaska': 98,
'Arizona': 99,
'Arkansas': 100,
'Ashland, NE': 101,
'Bennington County, VT': 102,
'Bergen County, NJ': 103,
'Berkeley, CA': 104,
'Berkshire County, MA': 105,
'Boston, MA': 106,
'Broward County, FL': 107,
'California': 108,
'Carver County, MN': 109,
'Charleston County, SC': 110,
'Charlotte County, FL': 111,
'Chatham County, NC': 112,
'Cherokee County, GA': 113,
'Chicago': 115,
'Chicago, IL': 115,
'Clark County, NV': 116,
'Clark County, WA': 117,
'Cobb County, GA': 118,
'Collin County, TX': 119,
'Colorado': 120,
'Connecticut': 121,
'Contra Costa County, CA': 122,
'Cook County, IL': 123,
'Davidson County, TN': 124,
'Davis County, UT': 125,
'Delaware': 126,
'Delaware County, PA': 127,
'Denver County, CO': 128,
'District of Columbia': 130,
'Douglas County, CO': 131,
'Douglas County, NE': 132,
'Douglas County, OR': 133,
'El Paso County, CO': 134,
'Fairfax County, VA': 135,
'Fairfield County, CT': 136,
'Fayette County, KY': 137,
'Florida': 138,
'Floyd County, GA': 139,
'Fort Bend County, TX': 140,
'Fresno County, CA': 141,
'Fulton County, GA': 142,
'Georgia': 143,
'Grafton County, NH': 144,
'Grand Princess Cruise Ship': -102,
'Grant County, WA': 147,
'Guam': 148,
'Harford County, MD': 149,
'Harris County, TX': 150,
'Harrison County, KY': 151,
'Hawaii': 152,
'Hendricks County, IN': 153,
'Hillsborough, FL': 154,
'Honolulu County, HI': 155,
'Hudson County, NJ': 156,
'Humboldt County, CA': 157,
'Idaho': 158,
'Illinois': 159,
'Indiana': 160,
'Iowa': 161,
'Jackson County, OR': 162,
'Jefferson County, KY': 163,
'Jefferson County, WA': 164,
'Jefferson Parish, LA': 165,
'Johnson County, IA': 166,
'Johnson County, KS': 167,
'Kansas': 168,
'Kentucky': 169,
'Kershaw County, SC': 170,
'King County, WA': 171,
'Kittitas County, WA': 172,
'Klamath County, OR': 173,
'Lackland, TX': 174,
'Lackland, TX (From Diamond Princess)': -100,
'Lee County, FL': 176,
'Los Angeles, CA': 177,
'Louisiana': 178,
'Madera County, CA': 179,
'Madison, WI': 180,
'Maine': 181,
'Manatee County, FL': 182,
'Maricopa County, AZ': 183,
'Marion County, IN': 184,
'Marion County, OR': 185,
'Maryland': 186,
'Massachusetts': 187,
'Michigan': 188,
'Middlesex County, MA': 189,
'Minnesota': 190,
'Mississippi': 191,
'Missouri': 192,
'Montana': 193,
'Montgomery County, MD': 194,
'Montgomery County, PA': 195,
'Montgomery County, TX': 196,
'Nassau County, NY': 197,
'Nebraska': 198,
'Nevada': 199,
'New Hampshire': 200,
'New Jersey': 201,
'New Mexico': 202,
'New York': 203,
'New York City, NY': 204,
'New York County, NY': 205,
'North Carolina': 207,
'North Dakota': 208,
'Norwell County, MA': 209,
'Ohio': 210,
'Okaloosa County, FL': 211,
'Oklahoma': 212,
'Omaha, NE (From Diamond Princess)': -100,
'Orange County, CA': 214,
'Orange, CA': 215,
'Oregon': 216,
'Pennsylvania': 217,
'Pierce County, WA': 218,
'Pinal County, AZ': 219,
'Placer County, CA': 220,
'Plymouth County, MA': 221,
'Polk County, GA': 222,
'Portland, OR': 223,
'Providence County, RI': 224,
'Providence, RI': 225,
'Puerto Rico': 226,
'Queens County, NY': 227,
'Ramsey County, MN': 228,
'Rhode Island': 229,
'Riverside County, CA': 230,
'Rockingham County, NH': 231,
'Rockland County, NY': 232,
'Sacramento County, CA': 233,
'San Antonio, TX': 234,
'San Benito, CA': 235,
'San Diego County, CA': 236,
'San Francisco County, CA': 237,
'San Mateo, CA': 238,
'Santa Clara County, CA': 239,
'Santa Clara, CA': 240,
'Santa Cruz County, CA': 241,
'Santa Rosa County, FL': 242,
'Sarasota, FL': 243,
'Saratoga County, NY': 244,
'Seattle, WA': 245,
'Shasta County, CA': 246,
'Shelby County, TN': 247,
'Snohomish County, WA': 248,
'Sonoma County, CA': 249,
'South Carolina': 250,
'South Dakota': 251,
'Spartanburg County, SC': 252,
'Spokane County, WA': 253,
'St. Louis County, MO': 254,
'Suffolk County, MA': 255,
'Suffolk County, NY': 256,
'Summit County, CO': 257,
'Tempe, AZ': 258,
'Tennessee': 259,
'Texas': 260,
'Travis, CA': 261,
'Travis, CA (From Diamond Princess)': -100,
'Tulsa County, OK': 263,
'US': 264,
'Ulster County, NY': 265,
'Umatilla, OR': 266,
'Unassigned Location (From Diamond Princess)': -100,
'Unassigned Location, VT': 268,
'Unassigned Location, WA': 279,
'United States Virgin Islands': 270,
'Unknown Location, MA': 187,
'Utah': 272,
'Vermont': 268,
'Virgin Islands': 270,
'Virgin Islands, U.S.': 270,
'Virginia': 276,
'Volusia County, FL': 277,
'Wake County, NC': 278,
'Washington': 279,
'Washington County, OR': 280,
'Washington, D.C.': 281,
'Washoe County, NV': 282,
'Wayne County, PA': 283,
'West Virginia': 284,
'Westchester County, NY': 285,
'Williamson County, TN': 286,
'Wisconsin': 287,
'Wyoming': 288,
'Yolo County, CA': 289
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment