def download_indicator_data(worldbank_countries, indicator_codes):
    ' Downloads World Bank country data for all countries and\n            indicators provided.\n\n        Retains only the unique indicator codes provided.\n\n        Args:\n            worldbank_countries: Dataframe with ISO 3166 alpha 3 code for each\n                country.\n            indicator_code: Dataframe with INDICATOR_CODES to include.\n\n        Returns:\n            worldbank_dataframe: A tidied pandas dataframe where each row has\n            the format (indicator code, ISO 3166 alpha 3, year, value)\n            for all countries and all indicators provided.\n    '
    worldbank_dataframe = pd.DataFrame()
    indicators_to_keep = list(indicator_codes['IndicatorCode'].unique())
    for (index, country_code) in enumerate(worldbank_countries['ISO3166Alpha3']):
        print(f'Downloading {country_code}')
        country_df = read_worldbank(country_code)
        country_df = country_df[country_df['IndicatorCode'].isin(indicators_to_keep)]
        country_df['ISO3166Alpha3'] = country_code
        worldbank_dataframe = worldbank_dataframe.append(country_df)
    worldbank_dataframe['StatisticalVariable'] = worldbank_dataframe['IndicatorCode'].apply((lambda code: f"WorldBank/{code.replace('.', '_')}"))
    return worldbank_dataframe.rename({'year': 'Year'}, axis=1)
Downloads World Bank country data for all countries and
    indicators provided.

Retains only the unique indicator codes provided.

Args:
    worldbank_countries: Dataframe with ISO 3166 alpha 3 code for each
        country.
    indicator_code: Dataframe with INDICATOR_CODES to include.

Returns:
    worldbank_dataframe: A tidied pandas dataframe where each row has
    the format (indicator code, ISO 3166 alpha 3, year, value)
    for all countries and all indicators provided.
def download_indicator_data(worldbank_countries, indicator_codes):
    ' Downloads World Bank country data for all countries and\n            indicators provided.\n\n        Retains only the unique indicator codes provided.\n\n        Args:\n            worldbank_countries: Dataframe with ISO 3166 alpha 3 code for each\n                country.\n            indicator_code: Dataframe with INDICATOR_CODES to include.\n\n        Returns:\n            worldbank_dataframe: A tidied pandas dataframe where each row has\n            the format (indicator code, ISO 3166 alpha 3, year, value)\n            for all countries and all indicators provided.\n    '
    worldbank_dataframe = pd.DataFrame()
    indicators_to_keep = list(indicator_codes['IndicatorCode'].unique())
    for (index, country_code) in enumerate(worldbank_countries['ISO3166Alpha3']):
        print(f'Downloading {country_code}')
        country_df = read_worldbank(country_code)
        country_df = country_df[country_df['IndicatorCode'].isin(indicators_to_keep)]
        country_df['ISO3166Alpha3'] = country_code
        worldbank_dataframe = worldbank_dataframe.append(country_df)
    worldbank_dataframe['StatisticalVariable'] = worldbank_dataframe['IndicatorCode'].apply((lambda code: f"WorldBank/{code.replace('.', '_')}"))
    return worldbank_dataframe.rename({'year': 'Year'}, axis=1)