1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-11-22 05:45:02 +01:00

csv_metadata_quality/fix.py: don't add "not found" region

country_converter returns the literal "not found" string if a coun-
try cannot be found. In that case we do not want to consider that as
a region!
This commit is contained in:
Alan Orth 2022-09-01 15:46:21 +03:00
parent 7c61cae417
commit 473be5ac2f
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -360,7 +360,9 @@ def countries_match_regions(row):
# the parent regions ("Sub-Saharan Africa", "Africa", "World")
un_region = cc.convert(names=country, to="UNRegion")
if un_region not in regions:
# Add the new un_region to regions if it is not "not found" and if
# it doesn't already exist in regions.
if un_region != "not found" and un_region not in regions:
if un_region not in missing_regions:
missing_regions.append(un_region)