1
$\begingroup$

I want to create a map where countries specified in dataframe are filled with colour green or red. The colour is depending on value in column 'PREFERENCE' (equals 1 or 0). Whwn I execute the following code only map with colour grey are displayed. Why is that so? Is the Chloropeth Map the right solution for this kind of task?

europe_map = folium.Map(location=[51.0, 10.0], zoom_start=4)
europe_geo = "datasets\eu-countries.geo.json"

folium.Choropleth(
    geo_data=europe_geo,
    data=geolocation_df,
    columns=['COUNTRY', 'PREFERENCE'],
    key_on='feature.properties.name',
    fill_color='YlGn',
    fill_opacity=0.3,
    line_weight=1
).add_to(europe_map)

europe_map

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.