From c9582112cfc428b84aee45f89d5dd14bd809b192 Mon Sep 17 00:00:00 2001 From: Konstantin Stadler Date: Fri, 10 Nov 2023 09:02:50 +0100 Subject: [PATCH] finalize bug fix --- CHANGELOG.md | 5 +++++ README.md | 11 +++++++---- country_converter/country_converter.py | 2 +- country_converter/country_data.tsv | 2 +- tests/test_regex_misc.txt | 1 + 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb7593..7a587d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +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 0abe39a..ec2186b 100644 --- a/country_converter/country_data.tsv +++ b/country_converter/country_data.tsv @@ -28,7 +28,7 @@ Bhutan Kingdom of Bhutan bhutan BT BTN 64 64 18 162 Asia Southern Asia WW WA WA 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 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 diff --git a/tests/test_regex_misc.txt b/tests/test_regex_misc.txt index 3166852..64c255f 100644 --- a/tests/test_regex_misc.txt +++ b/tests/test_regex_misc.txt @@ -17,6 +17,7 @@ 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.