Glider
Loading...
Searching...
No Matches
TerritoryCode.py
Go to the documentation of this file.
1territory_iso_code = {'Andorra': 'AD', 'The United Arab Emirates': 'AE', 'Afghanistan': 'AF', 'Antigua and Barbuda': 'AG', 'Anguilla': 'AI', 'Albania': 'AL',
2'Armenia': 'AM', 'Netherlands Antilles': 'AN', 'Angola': 'AO', 'Antarctica': 'AQ', 'Argentina': 'AR', 'American Samoa': 'AS', 'Austria': 'AT', 'Australia': 'AU',
3'Aruba': 'AW', 'Åland Islands': 'AX', 'Azerbaijan': 'AZ', 'Bosnia and Herzegovina': 'BA', 'Barbados': 'BB', 'Bangladesh': 'BD', 'Belgium': 'BE',
4'Burkina Faso': 'BF', 'Bulgaria': 'BG', 'Bahrain': 'BH', 'Burundi': 'BI', 'Benin': 'BJ', 'Saint Barthélemy': 'BL', 'Bermuda': 'BM', 'Brunei': 'BN',
5'Bolivia': 'BO', 'Bonaire, Sint Eustatius and Saba': 'BQ', 'Brazil': 'BR', 'The Bahamas': 'BS', 'Bhutan': 'BT', 'Bouvet Island': 'BV', 'Botswana': 'BW',
6'Belarus': 'BY', 'Belize': 'BZ', 'Canada': 'CA', 'Cocos Islands': 'CC', 'The Democratic Republic of the Congo': 'CD', 'The Central African Republic': 'CF',
7'The Congo': 'CG', 'Switzerland': 'CH', "Côte d'Ivoire": 'CI', 'Cook Islands': 'CK', 'Chile': 'CL', 'Cameroon': 'CM', 'China': 'CN', 'Colombia': 'CO',
8'Costa Rica': 'CR', 'Serbia and Montenegro': 'CS', 'Cuba': 'CU', 'Cape Verde': 'CV', 'Curaçao': 'CW', 'Christmas Island': 'CX', 'Cyprus': 'CY', 'Czechia': 'CZ',
9'Germany': 'DE', 'Djibouti': 'DJ', 'Denmark': 'DK', 'Dominica': 'DM', 'The Dominican Republic': 'DO', 'Algeria': 'DZ', 'Ecuador': 'EC', 'Estonia': 'EE', 'Egypt':
10'EG', 'Western Sahara': 'EH', 'Eritrea': 'ER', 'Spain': 'ES', 'Ceuta, Spain': 'ES-CE', 'Canary Islands, Spain': 'ES-CN', 'Melilla, Spain': 'ES-ML', 'Ethiopia': 'ET',
11'Finland': 'FI', 'Fiji': 'FJ', 'Falkland Islands': 'FK', 'Micronesia': 'FM', 'Faroe Islands': 'FO', 'France': 'FR', 'Gabon': 'GA', 'The United Kingdom': 'GB',
12'Grenada': 'GD', 'Georgia': 'GE', 'French Guiana': 'GF', 'Guernsey': 'GG', 'Ghana': 'GH', 'Gibraltar': 'GI', 'Greenland': 'GL', 'The Gambia': 'GM', 'Guinea': 'GN',
13'Guadeloupe': 'GP', 'Equatorial Guinea': 'GQ', 'Greece': 'GR', 'South Georgia and The South Sandwich Islands': 'GS', 'Guatemala': 'GT', 'Guam': 'GU',
14'Guinea-Bissau': 'GW', 'Guyana': 'GY', 'Hong Kong': 'HK', 'Heard Island and McDonald Islands': 'HM', 'Honduras': 'HN', 'Croatia': 'HR', 'Haiti': 'HT',
15'Hungary': 'HU', 'Indonesia': 'ID', 'Ireland': 'IE', 'Israel': 'IL', 'Isle of Man': 'IM', 'India': 'IN', 'The British Indian Ocean Territory': 'IO', 'Iraq': 'IQ',
16'Iran': 'IR', 'Iceland': 'IS', 'Italy': 'IT', 'Jersey': 'JE', 'Jamaica': 'JM', 'Jordan': 'JO', 'Japan': 'JP', 'Kenya': 'KE', 'Kyrgyzstan': 'KG', 'Cambodia': 'KH',
17'Kiribati': 'KI', 'The Comoros': 'KM', 'Saint Kitts and Nevis': 'KN', 'Korea (North)': 'KP', 'Korea (South)': 'KR', 'Kuwait': 'KW', 'Cayman Islands': 'KY',
18'Kazakhstan': 'KZ', 'Laos': 'LA', 'Lebanon': 'LB', 'Saint Lucia': 'LC', 'Liechtenstein': 'LI', 'Sri Lanka': 'LK', 'Liberia': 'LR', 'Lesotho': 'LS',
19'Lithuania': 'LT', 'Luxembourg': 'LU', 'Latvia': 'LV', 'Libya': 'LY', 'Morocco': 'MA', 'Monaco': 'MC', 'Moldova': 'MD', 'Montenegro': 'ME', 'Saint Martin': 'MF',
20'Madagascar': 'MG', 'The Marshall Islands': 'MH', 'Macedonia': 'MK', 'Mali': 'ML', 'Myanmar': 'MM', 'Mongolia': 'MN', 'Macao': 'MO', 'Northern Mariana Islands': 'MP',
21'Martinique': 'MQ', 'Mauritania': 'MR', 'Montserrat': 'MS', 'Malta': 'MT', 'Mauritius': 'MU', 'Maldives': 'MV', 'Malawi': 'MW', 'Mexico': 'MX', 'Malaysia': 'MY',
22'Mozambique': 'MZ', 'Namibia': 'NA', 'New Caledonia': 'NC', 'The Niger': 'NE', 'Norfolk Island': 'NF', 'Nigeria': 'NG', 'Nicaragua': 'NI', 'The Netherlands': 'NL',
23'Norway': 'NO', 'Nepal': 'NP', 'Nauru': 'NR', 'Niue': 'NU', 'New Zealand': 'NZ', 'Oman': 'OM', 'Panama': 'PA', 'Peru': 'PE', 'French Polynesia': 'PF',
24'Papua New Guinea': 'PG', 'The Philippines': 'PH', 'Pakistan': 'PK', 'Poland': 'PL', 'Saint Pierre and Miquelon': 'PM', 'Pitcairn': 'PN', 'Puerto Rico': 'PR',
25'The Occupied Palestinian Territory': 'PS', 'Portugal': 'PT', 'Palau': 'PW', 'Paraguay': 'PY', 'Qatar': 'QA', 'Réunion': 'RE', 'Romania': 'RO', 'Serbia': 'RS',
26'Russia': 'RU', 'Rwanda': 'RW', 'Saudi Arabia': 'SA', 'Solomon Islands': 'SB', 'Seychelles': 'SC', 'The Sudan': 'SD', 'Sweden': 'SE', 'Singapore': 'SG',
27'Saint Helena': 'SH', 'Slovenia': 'SI', 'Svalbard and Jan Mayen': 'SJ', 'Slovakia': 'SK', 'Sierra Leone': 'SL', 'San Marino': 'SM', 'Senegal': 'SN', 'Somalia': 'SO',
28'Suriname': 'SR', 'South Soudan': 'SS', 'Sao Tome and Principe': 'ST', 'El Salvador': 'SV', 'Sint Maarten': 'SX', 'Syria': 'SY', 'Eswatini': 'SZ',
29'Turks and Caicos Islands': 'TC', 'Chad': 'TD', 'The French Southern Territories': 'TF', 'Togo': 'TG', 'Thailand': 'TH', 'Tajikistan': 'TJ', 'Tokelau': 'TK',
30'Timor-Leste': 'TL', 'Turkmenistan': 'TM', 'Tunisia': 'TN', 'Tonga': 'TO', 'Turkey': 'TR', 'Trinidad and Tobago': 'TT', 'Tuvalu': 'TV', 'Taiwan': 'TW',
31'Tanzania': 'TZ', 'Ukraine': 'UA', 'Uganda': 'UG', 'United States Minor Outlying Islands': 'UM', 'The United States': 'US', 'Uruguay': 'UY', 'Uzbekistan': 'UZ',
32'The Holy See': 'VA', 'Saint Vincent and The Grenadines': 'VC', 'Venezuela': 'VE', 'British Virgin Islands': 'VG', 'US Virgin Islands': 'VI', 'Viet Nam': 'VN',
33'Vanuatu': 'VU', 'Wallis and Futuna': 'WF', 'Samoa': 'WS', 'Yemen': 'YE', 'Mayotte': 'YT', 'South Africa': 'ZA', 'Zambia': 'ZM', 'Zimbabwe': 'ZW', 'Bahamas': 'BS',
34'Bolivia (Plurinational State of)': 'BO', 'Bosnia-Hercegovina': 'BA', 'British Indian Ocean Territory': 'IO', 'Brunei Darussalam': 'BN', 'Cabo Verde': 'CV',
35'Central African Republic': 'CF', 'China (PRC)': 'CN', 'Cocos (Keeling) Islands': 'CC', 'Comoros': 'KM', 'Congo': 'CG', 'Congo, Democratic Republic of the': 'CD',
36'Czech Republic': 'CZ', 'Dominican Republic': 'DO', 'Falkland Islands (Malvinas)': 'FK', 'French Southern Territories': 'TF', 'Gambia': 'GM', 'Holy See': 'VA',
37'Iran (Islamic Republic of)': 'IR', 'Kyrgyz Republic': 'KG', "Lao People's Democratic Republic": 'LA', 'North Macedonia': 'MK', 'Marshall Islands': 'MH',
38'Netherlands': 'NL', 'Niger': 'NE', 'Palestine, State of': 'PS', 'Philippines': 'PH', 'Saint Helena, Ascension and Tristan da Cunha': 'SH',
39'Saint Martin (French part)': 'MF', 'Saint Vincent and the Grenadines': 'VC', 'Sint Maarten (Dutch part)': 'SX', 'Slovak Republic': 'SK',
40'South Georgia and the South Sandwich Islands': 'GS', 'South Sudan': 'SS', 'Sudan': 'SD', 'Syrian Arab Republic': 'SY', 'Tanzania, United Republic of': 'TZ',
41'USA': 'US', 'United Arab Emirates': 'AE', 'United Kingdom': 'GB', 'United States of America': 'US', 'Vietnam': 'VN', 'Virgin Islands (British)': 'VG',
42'Virgin Islands (U.S.)': 'VI', 'Zanzibar': 'TZ'}
43
45 def terr_iso(self, df, iso):
46 return iso[df]
47
48 def territory_code(self, df, territory_iso_code=territory_iso_code):
49 df["Territory"] = df.apply(lambda Row: self.terr_iso(Row['Territory'], territory_iso_code), axis=1)
50 return df
territory_code(self, df, territory_iso_code=territory_iso_code)