Data
Original Research
To make the database compatible with other database, we encode country names with the World Bank's country name coder and manually fix mistakes.
target_countries = wb.economy.coder(orig_df['Country'])
orig_df['Country Code'] = target_countries
orig_df.at[11, "Country Code"] = "COG"
orig_df.at[46, "Country Code"] = "SDS"
target_countries.head()
World Bank
wb_final_df = wb_average_df.copy()
wb_final_df[wb_to_scale] = wb_final_df[wb_to_scale].div(wb_final_df.Population, axis = 0)
wb_final_df
UNICEF
Merge
Mapping
"""
Get latitudes of longitudes.
"""
geolocator = GeoNames(username = "sydneydegen1")
def geolocate(country):
# Geolocate the center of the country
loc = geolocator.geocode(query=country)
# And return latitude and longitude
return (loc.latitude, loc.longitude) if loc else (0,0)
final_df[["Latitude", "Longitude"]] = final_df["Country"].apply(geolocate).apply(pd.Series)
options = list(final_df.columns)
map_feature