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

csv_metadata_quality/fix.py: fix bug in regions

We need to make sure we're only manipulating the regions if we have
any missing. The previous code was always manipulating the existing
row, even when there were no missing regions, which resulted in new
values like "Eastern Africa||".
This commit is contained in:
Alan Orth 2022-09-01 16:15:32 +03:00
parent 7ce20726d0
commit f49214fa2e
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -369,6 +369,7 @@ def countries_match_regions(row):
)
missing_regions.append(un_region)
if len(missing_regions) > 0:
# Add the missing regions back to the row, paying attention to whether
# or not the row's region column is None (aka null) or just an empty
# string (length would be 0).