mirror of
https://github.com/ilri/csv-metadata-quality.git
synced 2024-11-24 14:50:17 +01:00
csv_metadata_quality/fix.py: minor change
Print missing regions when we know they are missing, instead of do- ing another check later and looping over them again.
This commit is contained in:
parent
473be5ac2f
commit
7ce20726d0
@ -364,14 +364,11 @@ def countries_match_regions(row):
|
||||
# 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:
|
||||
print(
|
||||
f"{Fore.YELLOW}Adding missing region ({un_region}): {Fore.RESET}{row[title_column_name]}"
|
||||
)
|
||||
missing_regions.append(un_region)
|
||||
|
||||
if len(missing_regions) > 0:
|
||||
for missing_region in missing_regions:
|
||||
print(
|
||||
f"{Fore.YELLOW}Adding missing region ({missing_region}): {Fore.RESET}{row[title_column_name]}"
|
||||
)
|
||||
|
||||
# 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).
|
||||
|
Loading…
Reference in New Issue
Block a user