Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions scripts/world_bank/wdi/worldbank.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ def read_worldbank(iso3166alpha3, mode):
if file.startswith("API"):
file_to_open = file
break
assert file_to_open is not None, \
"Failed to find data for" + iso3166alpha3

if file_to_open is None:
logging.warning('Failed to find data for %s in the downloaded ZIP. Skipping.', iso3166alpha3)
return None
df = None
# Captures any text contained in double quotatations.
line_match = re.compile(r"\"([^\"]*)\"")
Expand Down Expand Up @@ -415,6 +415,9 @@ def download_indicator_data(worldbank_countries, indicator_codes, mode):
for index, country_code in enumerate(worldbank_countries['ISO3166Alpha3']):
country_df = read_worldbank(country_code, mode)

if country_df is None:
continue

# Remove unneccessary indicators.
country_df = country_df[country_df['IndicatorCode'].isin(
indicators_to_keep)]
Expand Down
Loading