Skip to content

Instantly share code, notes, and snippets.

@amitrani6
Last active June 15, 2022 02:11
Show Gist options
  • Save amitrani6/68c52dba5d2dfe52e132fa63db6e297b to your computer and use it in GitHub Desktop.
Save amitrani6/68c52dba5d2dfe52e132fa63db6e297b to your computer and use it in GitHub Desktop.
# Import the folium library (only shown here once)
import folium
m = folium.Map(location=[48, -102], zoom_start=3)
folium.Choropleth(
geo_data=usmap_json_no_id,
name="choropleth",
data=all_states_census_df,
columns=["state", "Total_Pop_2021"],
key_on="feature.properties.GEOID",
fill_color="YlGn",
fill_opacity=0.7,
line_opacity=0.2,
legend_name="Total Population By State, 2021",
).add_to(m)
folium.LayerControl().add_to(m)
# Display the Choropleth
m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment