Closed oliviachang29 closed 2 years ago
Oh good catch @oliviachang29 !!!
I'll merge the pull. A cleaner approach, in the future, might be to load in the states_geography
geojson (or indeed, any spatial data) in the notebook environment and then pass it to the choropleth_mapper()
like so:
def state_choropleth_mapper(states_geo, state_data, column, legend_name, color_scheme="PuRd"):
map = folium.Map()
m = folium.Choropleth(
geo_data = states_geo,
name="choropleth",
data=state_data,
columns=["STUSPS",column],
.....
and then in the notebook doing:
states_geography = geopandas.read_file("https://raw.githubusercontent.com/edgi-govdata-archiving/ECHO-Geo/main/cb_2018_us_state_500k.json")
states_geography.crs = "EPSG:4326"
state_choropleth_mapper(states_geography, data, "column", "legend")
this would lead the way to making the state_choropleth_mapper()
a more general choropleth mapper, handling any input (would need to add an option to change the matching column from STUSPS
to the input.
Got it!
Realized that storing the geojson data for the states and storing it in
states
was overriding the states import fromECHO_modules.geographies
! Renamed it tostates_geography
.