diff --git a/CHANGELOG.md b/CHANGELOG.md index c75117b..7a587d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,20 @@ ### Development - removed htmlcov +- fixed numerical position warning ### Classifications +- Added CC41 common classification (by @hazimhussein) - Correct spelling "Faeroe Islands" to "Faroe Islands" #145 (by @jpatokal) +- Added country code for Kosovo (by @jimmy927) +- Added Carribian Netherlands/Bonaire (by @jimmy927) +- Switched short name of Czech Republic to Czechia +- Added EL to the ISO2 codes for Greece +- Allow Guiana/Guiyana in most cases when given British/Dutch/French prefix +- Allow Gabun/Gabon +- Allow Botsuana/Botswana +- Allow England for UK ## 1.0.0 diff --git a/README.md b/README.md index e59fdf3..493798b 100644 --- a/README.md +++ b/README.md @@ -379,7 +379,7 @@ python as well as in matlab. For further information see Currently the following classification schemes are available (see also Data sources below for further information): -1. ISO2 (ISO 3166-1 alpha-2) +1. ISO2 (ISO 3166-1 alpha-2) - including UK/EL for Britain/Greece (but always convert to GB/GR) 2. ISO3 (ISO 3166-1 alpha-3) 3. ISO - numeric (ISO 3166-1 numeric) 4. UN numeric code (M.49 - follows to a large extend ISO-numeric) @@ -448,9 +448,12 @@ Note that the underlying dataframe is available at the attribute .data ## Data sources and further reading -Most of the underlying data can be found in Wikipedia, the page -describing [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) is a -good starting point. UN regions/codes are given on the United Nation +Most of the underlying data can be found in Wikipedia, the page describing [ISO +3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) is a good starting point. The +page on the [ISO2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) +includes a section "Imperfect Implementations" explaining the GB/UK and EL/GR +issue. +UN regions/codes are given on the United Nation Statistical Division ([unstats](http://unstats.un.org/unsd/methods/m49/m49regin.htm)) webpage. The differences between the ISO numeric and UN (M.49) codes are diff --git a/country_converter/country_converter.py b/country_converter/country_converter.py index 277c95d..54fb81c 100644 --- a/country_converter/country_converter.py +++ b/country_converter/country_converter.py @@ -966,7 +966,7 @@ def cli_output(conv_names, sep): conv_names = conv_names.iloc[:, 0].tolist() elif len(conv_names.columns) == 2: for row in conv_names.iterrows(): - print(str(row[1][0]) + sep + str(row[1][1])) + print(str(row[1].iloc[0]) + sep + str(row[1].iloc[1])) return print( sep.join( diff --git a/country_converter/country_data.tsv b/country_converter/country_data.tsv index 73c41ca..ec2186b 100644 --- a/country_converter/country_data.tsv +++ b/country_converter/country_data.tsv @@ -26,15 +26,15 @@ Benin Republic of Benin benin|dahome BJ BEN 204 204 53 200 Africa Western Africa Bermuda Bermuda bermuda BM BMU 60 60 17 305 America Northern America WW WL WL WWW WWL WWL RoW BMU LAC Central America LAM RoW Other non-OECD Americas bm Rest of World Bhutan Kingdom of Bhutan bhutan BT BTN 64 64 18 162 Asia Southern Asia WW WA WA WWW WWA WWA RoW BTN SAS Rest of South Asia OAS 1971 1971 RoW Other non-OECD Asia 630 bt 760 Rest of World Bolivia Plurinational State of Bolivia bolivia BO BOL 68 68 19 121 America South America WW WL WL WWW WWL WWL RoW BOL LAC Rest of South America LAM 1945 1945 RoW Plurinational State of Bolivia 428 bo 145 Rest of World -"Bonaire, Saint Eustatius and Saba" "Bonaire, Saint Eustatius and Saba" ^bonaire|(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\bbes.?islands BQ BES 535 535 278 America Caribbean WW WL WL WWW WWL WWL RoW LAC LAM RoW Other non-OECD Americas bq Rest of World +Bonaire, Saint Eustatius and Saba Bonaire, Saint Eustatius and Saba ^bonaire|(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\bbes.?islands BQ BES 535 535 278 America Caribbean WW WL WL WWW WWL WWL RoW LAC LAM RoW Other non-OECD Americas bq Rest of World Bosnia and Herzegovina Bosnia and Herzegovina herzegovina|bosnia BA BIH 70 70 80 44 Europe Southern Europe WW WE WE WWW WWE WWE RoW BIH EEU Central Europe NEU 1992 1992 RoW Bosnia and Herzegovina 64 ba 346 Rest of World -Botswana Republic of Botswana botswana|bechuana BW BWA 72 72 20 193 Africa Southern Africa WW WF WF WWW WWF WWF RoW BWA AFR Rest of Southern Africa SSA 1966 1966 RoW Botswana 227 bw 571 Rest of World +Botswana Republic of Botswana botswana|bechuana|botsuana BW BWA 72 72 20 193 Africa Southern Africa WW WF WF WWW WWF WWF RoW BWA AFR Rest of Southern Africa SSA 1966 1966 RoW Botswana 227 bw 571 Rest of World Bouvet Island Bouvet Island bouvet BV BVT 74 74 31 Antarctica South America WW WA WA WWW WWA WWA RoW LAM RoW Other non-OECD Asia Rest of World Brazil Federative Republic of Brazil brazil BR BRA 76 76 21 135 America South America BR BR BR BRA BRA BRA BRA BRA LAC Brazil LAM 1945 1945 BX BRIC BASIC G20 Brazil 431 br 140 Brazil British Antarctic Territories British Antarctic Territories br.*antarctic.?territ.* B1 BA1 Antarctica WW WA WA WWW WWA WWA RoW 1979 RoW Rest of World British Indian Ocean Territory British Indian Ocean Territory br.*indian.?ocean IO IOT 86 86 24 Africa Eastern Africa WW WA WA WWW WWA WWA RoW AFR OAS RoW Other non-OECD Asia io Rest of World British Virgin Islands British Virgin Islands ^(?=.*\bu\.?\s?k).*virgin|^(?=.*br.*).*virgin|^(?=.*kingdom).*virgin|BVI VG VGB 92 92 239 America Caribbean WW WL WL WWW WWL WWL RoW VGB LAC Central America LAM RoW Other non-OECD Americas vg Rest of World -Brunei Darussalam "Nation of Brunei, Abode of Peace" brunei BN BRN 96 96 26 66 Asia South-eastern Asia WW WA WA WWW WWA WWA RoW BRN PAS Southeastern Asia OAS 1984 1984 RoW APEC Brunei Darussalam bn 835 Rest of World +Brunei Darussalam Nation of Brunei, Abode of Peace brunei BN BRN 96 96 26 66 Asia South-eastern Asia WW WA WA WWW WWA WWA RoW BRN PAS Southeastern Asia OAS 1984 1984 RoW APEC Brunei Darussalam bn 835 Rest of World Bulgaria Republic of Bulgaria bulgaria BG BGR 100 100 27 45 Europe Eastern Europe BG BG BG BGR BGR BGR BGR BGR EEU Central Europe EUR EU EU28 EU27 EU27_2007 EEA 1955 1955 EU G20 Bulgaria 72 bg 355 Bulgaria Burkina Faso Burkina Faso burkina|\bfaso|upper.?volta BF BFA 854 854 233 201 Africa Western Africa WW WF WF WWW WWF WWF RoW BFA AFR Western Africa SSA 1960 1960 RoW Other Africa 287 bf 439 Rest of World Burundi Republic of Burundi burundi BI BDI 108 108 29 175 Africa Eastern Africa WW WF WF WWW WWF WWF RoW BDI AFR Eastern Africa SSA 1962 1962 RoW Other Africa 228 bi 516 Rest of World @@ -52,7 +52,7 @@ Christmas Island Christmas Island christmas CX CXR 162 162 42 Asia Australia an Cocos (Keeling) Islands Territory of the Cocos (Keeling) Islands \bcocos|keeling CC CCK 166 166 43 Asia Australia and New Zealand WW WA WA WWW WWA WWA RoW PAS OAS RoW Other non-OECD Asia cc Rest of World Colombia Republic of Colombia colombia CO COL 170 170 44 125 America South America WW WL WL WWW WWL WWL RoW COL LAC Rest of South America LAM 2020 1945 1945 RoW Colombia 437 co 100 Rest of World Comoros Union of the Comoros comoro KM COM 174 174 45 176 Africa Eastern Africa WW WF WF WWW WWF WWF RoW COM AFR Eastern Africa SSA 1975 1975 RoW Other Africa 233 km 581 Rest of World -Congo Republic Republic of the Congo "^(?!.*\bdem)(?!.*\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l\w{1,2}opoldville)(?!.*free)(^rep.*).*\bcongo.*(?!.*\bdem)(?!.*\bdr).*|\bwest.*congo|^congo[,;\s]*(?!.*dem)rep.*?$|^congo$|\bcongo.*brazza.*" CG COG 178 178 46 170 Africa Middle Africa WW WF WF WWW WWF WWF RoW COG AFR Western Africa SSA 1960 1960 RoW Republic of the Congo 234 cg 484 Rest of World +Congo Republic Republic of the Congo ^(?!.*\bdem)(?!.*\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l\w{1,2}opoldville)(?!.*free)(^rep.*).*\bcongo.*(?!.*\bdem)(?!.*\bdr).*|\bwest.*congo|^congo[,;\s]*(?!.*dem)rep.*?$|^congo$|\bcongo.*brazza.* CG COG 178 178 46 170 Africa Middle Africa WW WF WF WWW WWF WWF RoW COG AFR Western Africa SSA 1960 1960 RoW Republic of the Congo 234 cg 484 Rest of World Cook Islands Cook Islands \bcook CK COK 184 184 47 320 Oceania Polynesia WW WA WA WWW WWA WWA RoW COK PAS Oceania OAS RoW Other non-OECD Asia ck Rest of World Costa Rica Republic of Costa Rica costa.?rica CR CRI 188 188 48 126 America Central America WW WL WL WWW WWL WWL RoW CRI LAC Central America LAM 2021 1945 1945 RoW Costa Rica 336 cr 94 Rest of World Cote d'Ivoire Republic of Côte d'Ivoire .*(ivoire|ivory) CI CIV 384 384 107 205 Africa Western Africa WW WF WF WWW WWF WWF RoW CIV AFR Western Africa SSA 1960 1960 RoW Côte d'Ivoire 247 ci 437 Rest of World @@ -60,12 +60,12 @@ Croatia Republic of Croatia croatia|hrvatska HR HRV 191 191 98 46 Europe Souther Cuba Republic of Cuba \bcuba CU CUB 192 192 49 109 America Caribbean WW WL WL WWW WWL WWL RoW CUB LAC LAM 1945 1945 RoW Cuba 338 cu 40 Rest of World Curacao Country of Curaçao \bcura(c|ç)ao CW CUW 531 531 279 America Caribbean WW WL WL WWW WWL WWL RoW LAC LAM RoW Curaçao/Netherlands Antilles cw Rest of World Cyprus Republic of Cyprus cyprus CY CYP 196 196 50 77 Asia Western Asia CY CY CY CYP CYP CYP CYP CYP WEU Central Europe EUR EU EU28 EU27 EU27_2007 EU25 EEA 2008 1960 1960 EU G20 Cyprus 30 cy 352 Cyprus -Czech Republic Czech Republic ^(?=.*rep).*czech.*|czechia|bohemia|.*czech.* CZ CZE 203 203 167 47 Europe Eastern Europe CZ CZ CZ CZE CZE CZE CZE CZE EEU Central Europe EUR 1995 EU EU28 EU27 EU27_2007 EU25 EEA Schengen 1993 1993 EU G20 Czech Republic 68 cz 315 Czech Republic +Czechia Czech Republic ^(?=.*rep).*czech.*|czechia|bohemia|.*czech.* CZ CZE 203 203 167 47 Europe Eastern Europe CZ CZ CZ CZE CZE CZE CZE CZE EEU Central Europe EUR 1995 EU EU28 EU27 EU27_2007 EU25 EEA Schengen 1993 1993 EU G20 Czech Republic 68 cz 315 Czech Republic Denmark Kingdom of Denmark denmark DK DNK 208 208 54 78 Europe Northern Europe DK DK DK DNK DNK DNK DNK DNK WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 1945 1945 EU G20 Denmark 3 dk 390 Denmark Djibouti Republic of Djibouti djibouti DJ DJI 262 262 72 177 Africa Eastern Africa WW WF WF WWW WWF WWF RoW DJI AFR Eastern Africa SSA 1977 1977 RoW Other Africa 274 dj 522 Rest of World Dominica Commonwealth of Dominica dominica(?!n) DM DMA 212 212 55 110 America Caribbean WW WL WL WWW WWL WWL RoW DMA LAC Central America LAM 1978 1978 RoW Other non-OECD Americas 378 dm 54 Rest of World Dominican Republic Dominican Republic dominican DO DOM 214 214 56 111 America Caribbean WW WL WL WWW WWL WWL RoW DOM LAC Central America LAM 1945 1945 RoW Dominican Republic 340 do 42 Rest of World -DR Congo Democratic Republic of the Congo "\bdem.*congo|congo.*\bdem|congo.*\bdr|\bdr.*congo|\bd\.?r\.?c|\bd\.?r\.?o\.?c|\br\.?d\.?c|belgian.?congo|congo.?free.?state|kinshasa|zaire|l\w{1,2}opoldville|^the\ congo$|^RDC$|^DROC$|\bcongo.*dem.*" CD COD 180 180 250 171 Africa Middle Africa WW WF WF WWW WWF WWF RoW COD AFR Western Africa SSA 1960 1960 RoW Democratic Republic of the Congo 235 cd 490 Rest of World +DR Congo Democratic Republic of the Congo \bdem.*congo|congo.*\bdem|congo.*\bdr|\bdr.*congo|\bd\.?r\.?c|\bd\.?r\.?o\.?c|\br\.?d\.?c|belgian.?congo|congo.?free.?state|kinshasa|zaire|l\w{1,2}opoldville|^the\ congo$|^RDC$|^DROC$|\bcongo.*dem.* CD COD 180 180 250 171 Africa Middle Africa WW WF WF WWW WWF WWF RoW COD AFR Western Africa SSA 1960 1960 RoW Democratic Republic of the Congo 235 cd 490 Rest of World Ecuador Republic of Ecuador ecuador EC ECU 218 218 58 122 America South America WW WL WL WWW WWL WWL RoW ECU LAC Rest of South America LAM 1945 1945 RoW Ecuador 440 ec 130 Rest of World Egypt Arab Republic of Egypt egypt EG EGY 818 818 59 141 Africa Northern Africa WW WM WM WWW WWM WWM RoW EGY MEA Northern Africa MEA 1945 1945 RoW Egypt 142 eg 651 Rest of World El Salvador Republic of El Salvador el.?salvador SV SLV 222 222 60 127 America Central America WW WL WL WWW WWL WWL RoW SLV LAC Central America LAM 1945 1945 RoW El Salvador 342 sv 92 Rest of World @@ -79,16 +79,16 @@ Falkland Islands Falkland Islands (Malvinas) falkland|malvinas FK FLK 238 238 65 Fiji Republic of Fiji fiji FJ FJI 242 242 66 22 Oceania Melanesia WW WA WA WWW WWA WWA RoW FJI PAS Oceania OAS 1970 1970 RoW Other non-OECD Asia 832 fj 950 Rest of World Finland Republic of Finland finland FI FIN 246 246 67 79 Europe Northern Europe FI FI FI FIN FIN FIN FIN FIN WEU Western Europe EUR 1969 EU EU28 EU27 EU27_2007 EU25 EU15 EEA Schengen 1999 1955 1955 EU G20 Finland 18 fi 375 Finland France French Republic ^(?!.*\bdep).*france|french.?republic|\bgaul FR FRA 250 250 68 80 Europe Western Europe FR FR FR FRA FRA FRA FRA FRA WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 1999 1945 1945 EU G7 G20 France 4 fr 220 France -French Guiana Guiana ^(?=.*french).*guiana|guiana GF GUF 254 254 69 America South America WW WL WL WWW WWL WWL RoW GUF LAC Rest of South America LAM RoW Other non-OECD Americas gf Rest of World +French Guiana Guiana ^(?=.*french).*gu(i|y)ana|^(?!.*brit)(?!.*dut).*guiana GF GUF 254 254 69 America South America WW WL WL WWW WWL WWL RoW GUF LAC Rest of South America LAM RoW Other non-OECD Americas gf Rest of World French Polynesia French Polynesia french.?polynesia PF PYF 258 258 70 Oceania Polynesia WW WA WA WWW WWA WWA RoW PYF PAS Oceania OAS RoW Other non-OECD Asia pf Rest of World French Southern Territories Territory of the French Southern and Antarctic Lands french.?southern|\bfr.*\bso.*\ban.*\b\bt TF ATF 260 260 71 Africa Eastern Africa WW WF WF WWW WWF WWF RoW OAS RoW Other Africa tf Rest of World -Gabon Gabonese Republic gabon GA GAB 266 266 74 173 Africa Middle Africa WW WF WF WWW WWF WWF RoW GAB AFR Western Africa SSA 1960 1960 RoW Gabon 239 ga 481 Rest of World +Gabon Gabonese Republic gab(o|u)n GA GAB 266 266 74 173 Africa Middle Africa WW WF WF WWW WWF WWF RoW GAB AFR Western Africa SSA 1960 1960 RoW Gabon 239 ga 481 Rest of World Gambia Republic of the Gambia gambia GM GMB 270 270 75 206 Africa Western Africa WW WF WF WWW WWF WWF RoW GMB AFR Western Africa SSA 1965 1965 RoW Other Africa 240 gm 420 Rest of World Georgia Georgia ^(?!.*south).*georgia(?!.*US.*) GE GEO 268 268 73 35 Asia Western Asia WW WA WA WWW WWA WWA RoW GEO FSU Russia region REF 1992 1992 RoW Georgia 612 ge 372 Rest of World -Germany Federal Republic of Germany "^(?!e|w)(fed)?.*germany(?!,? *e|,? *w)(,? *)(\bfed)?" DE DEU 276 276 79 81 Europe Western Europe DE DE DE DEU DEU DEU DEU DEU WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 1999 1973 1973 EU G7 G20 Germany 5 de 260 Germany +Germany Federal Republic of Germany ^(?!e|w)(fed)?.*germany(?!,? *e|,? *w)(,? *)(\bfed)? DE DEU 276 276 79 81 Europe Western Europe DE DE DE DEU DEU DEU DEU DEU WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 1999 1973 1973 EU G7 G20 Germany 5 de 260 Germany Ghana Republic of Ghana ghana|gold.?coast GH GHA 288 288 81 207 Africa Western Africa WW WF WF WWW WWF WWF RoW GHA AFR Western Africa SSA 1957 1957 RoW Ghana 241 gh 452 Rest of World Gibraltar Gibraltar gibraltar GI GIB 292 292 82 Europe Southern Europe WW WE WE WWW WWE WWE RoW GIB WEU Western Europe EUR RoW Gibraltar gi Rest of World -Greece Hellenic Republic greece|hellenic|hellas GR GRC 300 300 84 82 Europe Southern Europe GR GR GR GRC GRC GRC GRC GRC WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 2001 1945 1945 EU G20 Greece 40 gr 350 Greece +Greece Hellenic Republic greece|hellenic|hellas ^GR$|^EL$ GRC 300 300 84 82 Europe Southern Europe GR GR GR GRC GRC GRC GRC GRC WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 2001 1945 1945 EU G20 Greece 40 gr 350 Greece Greenland Greenland greenland GL GRL 304 304 85 349 America Northern America WW WL WL WWW WWL WWL RoW GRL WEU NEU Schengen RoW Other non-OECD Americas gl Rest of World Grenada Grenada grenada GD GRD 308 308 86 112 America Caribbean WW WL WL WWW WWL WWL RoW GRD LAC Central America LAM 1974 1974 RoW Other non-OECD Americas 381 gd 55 Rest of World Guadeloupe Guadeloupe guadeloupe GP GLP 312 312 87 America Caribbean WW WL WL WWW WWL WWL RoW GLP LAC Central America LAM RoW Other non-OECD Americas gp Rest of World @@ -96,8 +96,8 @@ Guam Guam \bguam GU GUM 316 316 88 351 Oceania Micronesia WW WA WA WWW WWA WWA R Guatemala Republic of Guatemala guatemala GT GTM 320 320 89 128 America Central America WW WL WL WWW WWL WWL RoW GTM LAC Central America LAM 1945 1945 RoW Guatemala 347 gt 90 Rest of World Guernsey Guernsey guernsey GG GGY 831 831 Europe Northern Europe WW WE WE WWW WWE WWE RoW GGY EUR RoW gg Rest of World Guinea Republic of Guinea ^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*pap)(?!.*new)(?!p.*n.*).*guinea GN GIN 324 324 90 208 Africa Western Africa WW WF WF WWW WWF WWF RoW GIN AFR Western Africa SSA 1958 1958 RoW Other Africa 243 gn 438 Rest of World -Guinea-Bissau Republic of Guinea-Bissau ^(.*portu).*guinea|guinea.*bissau GW GNB 624 624 175 209 Africa Western Africa WW WF WF WWW WWF WWF RoW GNB AFR Western Africa SSA 1974 1974 RoW Other Africa 244 gw 404 Rest of World -Guyana Co-operative Republic of Guyana guyana|british.?guiana GY GUY 328 328 91 113 America South America WW WL WL WWW WWL WWL RoW GUY LAC Rest of South America LAM 1966 1966 RoW Guyana 446 gy 110 Rest of World +Guinea-Bissau Republic of Guinea-Bissau ^(.*portu).*gu(i|y)nea|gu(y|i)nea.*bissau GW GNB 624 624 175 209 Africa Western Africa WW WF WF WWW WWF WWF RoW GNB AFR Western Africa SSA 1974 1974 RoW Other Africa 244 gw 404 Rest of World +Guyana Co-operative Republic of Guyana ^(?!.*fren)(?!.*dut).*\bguyana|^(.*brit).*gu(i|y)ana GY GUY 328 328 91 113 America South America WW WL WL WWW WWL WWL RoW GUY LAC Rest of South America LAM 1966 1966 RoW Guyana 446 gy 110 Rest of World Haiti Republic of Haiti (ha(i|\xef|\xc3\xaf)ti) HT HTI 332 332 93 114 America Caribbean WW WL WL WWW WWL WWL RoW HTI LAC Central America LAM 1945 1945 RoW Haiti 349 ht 41 Rest of World Heard and McDonald Islands Territory of Heard Island and McDonald Islands heard.*mc.*donald HM HMD 334 334 92 Asia Australia and New Zealand WW WA WA WWW WWA WWA RoW CAZ RoW Other non-OECD Asia hm Rest of World Honduras Republic of Honduras ^(?!.*brit).*honduras HN HND 340 340 95 129 America Central America WW WL WL WWW WWL WWL RoW HND LAC Central America LAM 1945 1945 RoW Honduras 351 hn 91 Rest of World @@ -145,7 +145,7 @@ Mauritania Islamic Republic of Mauritania mauritania MR MRT 478 478 136 212 Afri Mauritius Republic of Mauritius mauritius MU MUS 480 480 137 183 Africa Eastern Africa WW WF WF WWW WWF WWF RoW MUS AFR Eastern Africa SSA 1968 1968 RoW Mauritius 257 mu 590 Rest of World Mayotte Mayotte mayotte YT MYT 175 175 270 Africa Eastern Africa WW WF WF WWW WWF WWF RoW MYT AFR SSA RoW Other Africa yt Rest of World Mexico United Mexican States ^(?!.*new).*mexi(?!.*city) MX MEX 484 484 138 130 America Central America MX MX MX MEX MEX MEX MEX MEX LAC Mexico LAM 1994 1945 1945 BX APEC G20 Mexico 358 mx 70 Mexico -"Micronesia, Fed. Sts." Federated States of Micronesia micronesia FM FSM 583 583 145 25 Oceania Micronesia WW WA WA WWW WWA WWA RoW FSM PAS Oceania OAS 1991 1991 RoW Other non-OECD Asia 860 fm 987 Rest of World +Micronesia, Fed. Sts. Federated States of Micronesia micronesia FM FSM 583 583 145 25 Oceania Micronesia WW WA WA WWW WWA WWA RoW FSM PAS Oceania OAS 1991 1991 RoW Other non-OECD Asia 860 fm 987 Rest of World Moldova Republic of Moldova moldov|b(a|e)ssarabia MD MDA 498 498 146 61 Europe Eastern Europe WW WE WE WWW WWE WWE RoW MDA FSU Ukraine region REF 1992 1992 RoW CIS Republic of Moldova 93 md 359 Rest of World Monaco Principality of Monaco monaco MC MCO 492 492 140 367 Europe Western Europe WW WE WE WWW WWE WWE RoW MCO WEU Western Europe NEU 1993 1993 RoW mc 221 Rest of World Mongolia Mongolia mongolia MN MNG 496 496 141 38 Asia Eastern Asia WW WA WA WWW WWA WWA RoW MNG CPA China region OAS 1961 1961 RoW Mongolia 753 mn 712 Rest of World @@ -210,13 +210,13 @@ Soviet Union (former) Union of Soviet Socialist Republics (former) USSR|soviet S Spain Kingdom of Spain spain ES ESP 724 724 203 92 Europe Southern Europe ES ES ES ESP ESP ESP ESP ESP WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EU12 EEA Schengen 1999 1955 1955 EU G20 Spain 50 es 230 Spain Sri Lanka Democratic Socialist Republic of Sri Lanka sri.?lanka|ceylon LK LKA 144 144 38 17 Asia Southern Asia WW WA WA WWW WWA WWA RoW LKA SAS Rest of South Asia OAS 1955 1955 RoW Sri Lanka 640 lk 780 Rest of World St. Barths Territorial collectivity of Saint-Barthélemy barth|barts BL BLM 652 652 282 America Caribbean WW WL WL WWW WWL WWL RoW BLM LAM RoW Other non-OECD Americas Rest of World -St. Helena "Saint Helena, Ascension and Tristan da Cunha" helena SH SHN 654 654 187 Africa Western Africa WW WF WF WWW WWF WWF RoW SHN AFR Western Africa SSA RoW Other Africa 276 sh Rest of World +St. Helena Saint Helena, Ascension and Tristan da Cunha helena SH SHN 654 654 187 Africa Western Africa WW WF WF WWW WWF WWF RoW SHN AFR Western Africa SSA RoW Other Africa 276 sh Rest of World St. Kitts and Nevis Saint Kitts and Nevis kitts|\bnevis KN KNA 659 659 188 393 America Caribbean WW WL WL WWW WWL WWL RoW KNA LAC Central America LAM 1983 1983 RoW Other non-OECD Americas kn 60 Rest of World St. Lucia Saint Lucia \blucia LC LCA 662 662 189 116 America Caribbean WW WL WL WWW WWL WWL RoW LCA LAC Central America LAM 1979 1979 RoW Other non-OECD Americas 383 lc 56 Rest of World St. Pierre and Miquelon Saint Pierre and Miquelon miquelon PM SPM 666 666 190 America Northern America WW WL WL WWW WWL WWL RoW SPM NAM USA CAZ RoW Other non-OECD Americas pm Rest of World St. Vincent and the Grenadines Saint Vincent and the Grenadines vincent VC VCT 670 670 191 117 America Caribbean WW WL WL WWW WWL WWL RoW VCT LAC Central America LAM 1980 1980 RoW Other non-OECD Americas 384 vc 57 Rest of World Sudan Republic of the Sudan ^(?!.*\bs(?!u)).*sudan SD SDN 729 729 522 Africa Northern Africa WW WF WF WWW WWF WWF RoW SUD MEA Eastern Africa MEA 1956 1956 RoW Sudan 278 sd 625 Rest of World -Suriname Republic of Suriname surinam|dutch.?guiana SR SUR 740 740 207 118 America South America WW WL WL WWW WWL WWL RoW SUR LAC Rest of South America LAM 1975 1975 RoW Suriname 457 sr 115 Rest of World +Suriname Republic of Suriname surinam|dutch.?gu(i|y)ana SR SUR 740 740 207 118 America South America WW WL WL WWW WWL WWL RoW SUR LAC Rest of South America LAM 1975 1975 RoW Suriname 457 sr 115 Rest of World Svalbard and Jan Mayen Islands Svalbard and Jan Mayen Islands ^(?!norway).*svalbard SJ SJM 744 744 260 Europe Northern Europe WW WE WE WWW WWE WWE RoW SJM WEU NEU RoW Rest of World Sweden Kingdom of Sweden swedish|sweden(?!.*except) SE SWE 752 752 210 93 Europe Northern Europe SE SE SE SWE SWE SWE SWE SWE WEU Western Europe EUR 1961 EU EU28 EU27 EU27_2007 EU25 EU15 EEA Schengen 1946 1946 EU G20 Sweden 10 se 380 Sweden Switzerland Swiss Confederation switz|swiss CH CHE 756 756 211 94 Europe Western Europe CH CH CH CHE CHE CHE RoW CHE WEU Western Europe NEU 1961 Schengen 2002 2002 HI Switzerland 11 ch 225 Rest of World @@ -239,7 +239,7 @@ Tuvalu Tuvalu tuvalu TV TUV 798 798 227 416 Oceania Polynesia WW WA WA WWW WWA W Uganda Republic of Uganda uganda UG UGA 800 800 226 190 Africa Eastern Africa WW WF WF WWW WWF WWF RoW UGA AFR Eastern Africa SSA 1962 1962 RoW Other Africa 285 ug 500 Rest of World Ukraine Ukraine ukrain UA UKR 804 804 230 63 Europe Eastern Europe WW WE WE WWW WWE WWE RoW UKR FSU Ukraine region REF 1945 1945 RoW Ukraine 85 ua 369 Rest of World United Arab Emirates United Arab Emirates emirates|^u\.?a\.?e\.?$|united.?arab.?em AE ARE 784 784 225 156 Asia Western Asia WW WM WM WWW WWM WWM RoW ARE MEA Middle East MEA 1971 1971 RoW United Arab Emirates 576 ae 696 Rest of World -United Kingdom United Kingdom of Great Britain and Northern Ireland .*(united.?kingdom|britain|^u\.?k\.?$|gb) ^GB$|^UK$ GBR 826 826 229 95 Europe Northern Europe GB GB GB GBR GBR GBR GBR GBR WEU Western Europe EUR 1961 EU28 EU27_2007 EU25 EU15 EU12 1945 1945 EU G7 G20 United Kingdom 12 uk 200 Great Britain and N.I. +United Kingdom United Kingdom of Great Britain and Northern Ireland .*(united.?kingdom|britain|^u\.?k\.?$|gb)|england ^GB$|^UK$ GBR 826 826 229 95 Europe Northern Europe GB GB GB GBR GBR GBR GBR GBR WEU Western Europe EUR 1961 EU28 EU27_2007 EU25 EU15 EU12 1945 1945 EU G7 G20 United Kingdom 12 uk 200 Great Britain and N.I. United States United States of America ^(?!.*islands).*united.?states|^u\.?s\.?a\.?$|^u\.?s\.?$ US USA 840 840 231 102 America Northern America US US US USA USA USA USA USA NAM USA USA 1961 1945 1945 HI APEC G7 G20 United States 302 us 2 USA United States Minor Outlying Islands United States Minor Outlying Islands minor.?outlying.?is UM UMI 581 581 232 Oceania Micronesia WW WA WA WWW WWA WWA RoW OAS RoW Other non-OECD Asia Rest of World United States Virgin Islands Virgin Islands of the United States ^(?=.*\bu\.?\s?s).*virgin|^(?=.*states).*virgin VI VIR 850 850 240 422 America Caribbean WW WL WL WWW WWL WWL RoW VIR NAM Central America LAM RoW Other non-OECD Americas vi Rest of World @@ -248,7 +248,7 @@ Uzbekistan Republic of Uzbekistan uzbek UZ UZB 860 860 235 41 Asia Central Asia Vanuatu Republic of Vanuatu vanuatu|new.?hebrides VU VUT 548 548 155 30 Oceania Melanesia WW WA WA WWW WWA WWA RoW VUT PAS Oceania OAS 1981 1981 RoW Other non-OECD Asia 854 vu 935 Rest of World Vatican Vatican City State holy.?see|vatican|papal.?st VA VAT 336 336 94 Europe Southern Europe WW WE WE WWW WWE WWE RoW VAT WEU Western Europe NEU RoW va Rest of World Venezuela Bolivarian Republic of Venezuela venezuela VE VEN 862 862 236 133 America South America WW WL WL WWW WWL WWL RoW VEN LAC Rest of South America LAM 1945 1945 RoW Bolivarian Republic of Venezuela 463 ve 101 Rest of World -Vietnam Socialist Republic of Vietnam "^((?!n|s|.*republic)|(?=.*socialist)).*viet.?nam(?! *,? *n| *,? *s)" VN VNM 704 704 237 20 Asia South-eastern Asia WW WA WA WWW WWA WWA RoW VNM CPA Southeastern Asia OAS 1977 1977 RoW APEC Viet Nam 769 vn 817 Rest of World +Vietnam Socialist Republic of Vietnam ^((?!n|s|.*republic)|(?=.*socialist)).*viet.?nam(?! *,? *n| *,? *s) VN VNM 704 704 237 20 Asia South-eastern Asia WW WA WA WWW WWA WWA RoW VNM CPA Southeastern Asia OAS 1977 1977 RoW APEC Viet Nam 769 vn 817 Rest of World Wallis and Futuna Islands Wallis and Futuna Islands futuna|wallis WF WLF 876 876 243 Oceania Polynesia WW WA WA WWW WWA WWA RoW WLF PAS Oceania OAS RoW Other non-OECD Asia 876 wf Rest of World Western Sahara Western Sahara \bw.*sahara EH ESH 732 732 205 199 Africa Northern Africa WW WF WF WWW WWF WWF RoW ESH MEA Northern Africa MEA RoW Other Africa eh Rest of World Yemen Republic of Yemen yemen YE YEM 887 887 249 157 Asia Western Asia WW WM WM WWW WWM WWM RoW YEM MEA Middle East MEA 1947 1947 RoW Yemen 580 ye 680 Rest of World diff --git a/tests/test_functionality.py b/tests/test_functionality.py index 30b2af3..f08dbde 100644 --- a/tests/test_functionality.py +++ b/tests/test_functionality.py @@ -136,6 +136,9 @@ def test_toISO2_conversion(): assert "GB" == converter.convert("UK", src="ISO2", to="ISO2") assert "GB" == converter.convert("UK", to="ISO2") assert "GB" == converter.convert("GB", to="ISO2") + assert "GR" == converter.convert("GR", to="ISO2") + assert "GR" == converter.convert("EL", src="ISO2", to="ISO2") + assert "GR" == converter.convert("EL", to="ISO2") assert "GB" == converter.convert("GBR", to="ISO2") assert "TR" == converter.convert("TR", src="ISO2", to="ISO2") assert "TR" == converter.convert("TUR", src="ISO3", to="ISO2") @@ -599,6 +602,16 @@ def test_full_cli(capsys): sys.argv = _sysargv +def test_ISO_number_codes(): + """This is for ISO 3166 numeric""" + cc = coco.CountryConverter() + assert 32 == cc.convert("Argentina", to="ISOnumeric") + assert 208 == cc.convert("Denmark", to="isocode") + # based on https://www.worlddata.info/countrycodes.php + # some claim it 383, but this is the telefone calling code + assert 412 == cc.convert("Kosovo", to="ISOnumeric") + + def test_fao_number_codes(): cc = coco.CountryConverter() assert 21 == cc.convert("BRA", to="FAOcode") diff --git a/tests/test_regex_misc.txt b/tests/test_regex_misc.txt index 3e949bf..64c255f 100644 --- a/tests/test_regex_misc.txt +++ b/tests/test_regex_misc.txt @@ -4,6 +4,7 @@ Aland Islands Åland Is. Aland Islands Aland islands American Samoa American Samoa (US) Antigua and Barbuda Antigua & Barbuda +Aruba aruba Bahamas "Bahamas, The" Bolivia Bolivia (Plurinational State of) Bosnia and Herzegovina Bosnia Herzegovina @@ -12,6 +13,11 @@ Bouvet Island Bouvet Island (NO) Bouvet Island Bouvet island British Indian Ocean Territory Br. Indian Ocean Terr. British Indian Ocean Territory British indian ocean territory +Bonaire, Saint Eustatius and Saba bonaire, saint eustatius and saba +Bonaire, Saint Eustatius and Saba bonaire +Bonaire, Saint Eustatius and Saba Bonaire and Saint Eustatius +Bonaire, Saint Eustatius and Saba Caribian Netherlands +Botswana Botsuana Cabo Verde Cape Verde Cayman Islands Cayman Isds Central African Republic Central African Rep. @@ -26,7 +32,9 @@ Cote d'Ivoire Côte d'Ivoire Croatia hrvatska Croatia Croatia (local name: hrvatska) Curacao Curacao -Czech Republic Czech Rep. +Czechia Czech Rep. +Czechia czechia +Czechia Bohemia Dominican Republic Dominican Rep. Egypt "Egypt, Arab Rep." Eswatini Swaziland @@ -39,10 +47,16 @@ Falkland Islands Falkland islands (malvinas) Falkland Islands Falkland Isds (Malvinas) Fiji Fiji Islands France France(+DOM TOM) +French Guiana Guiana French Guiana French Guiana +French Guiana French Guyana French Polynesia French polynesia Gambia "Gambia, The" +Gabon Gabun +Gabon Gabon Guam Guam (US) +Guyana British Guyana +Guyana British Guiana Heard and McDonald Islands Heard and McDonald Islands (AU) Iran Islamic Republic of Iran Iran Iran (Islamic Republic of) @@ -71,10 +85,13 @@ Mexico Mexiko Moldova Rep. of Moldova Moldova "Moldova, republic of" Moldova Republic of Moldova +Moldova moldovia +Macau Macao Myanmar Burma Netherlands Antilles Neth. Antilles Netherlands Antilles neth antil Netherlands Antilles netherlands antilles +Netherlands Antilles Netherlands Antilles Netherlands netherlands New Caledonia New caledonia Norfolk Island Norfolk island @@ -108,6 +125,8 @@ St. Vincent and the Grenadines Saint Vincent/Grenadines St. Vincent and the Grenadines Saint vincent and the grenadines Sudan Sudan (up to 2011) Sudan Sudan (Former) +Suriname Dutch Guiana +Suriname Dutch Guyana Svalbard and Jan Mayen Islands "Svalbard, Jan Mayen Islands" Tanzania "Tanzania, united republic of" Tanzania United Rep. of Tanzania @@ -121,6 +140,9 @@ Timor-Leste East Timor Turks and Caicos Islands Turks and caicos islands Turks and Caicos Islands Turks and Caicos islands Turks and Caicos Islands Turks and Caicos Isds +United Kingdom UK +United Kingdom england +United Kingdom England United States USA United States United States of America Vatican Holy See (Vatican City State)