Hey all,
I managed to plot a px.choropleth_mapbox
, but I’d like to color my missing values (say, with gray). What’s the best approach to this? Couldn’t find anything. My code looks like this:
with open("geojson_map.geojson") as geofile:
geojson = json.load(geofile)
data_district= pd.read_csv('data_district.csv')
fig = px.choropleth_mapbox(data_district, geojson=geojson, locations='district', color='cap_rate',
featureidkey="properties.NOM_COM",
color_continuous_scale="Viridis",
range_color=(0, data_district.cap_rate.max()),
center=dict(lon=-70.67159, lat=-33.47636),
mapbox_style="carto-positron",
zoom=11,
opacity=0.5,
# labels={'unemp':'unemployment rate'}
)
fig.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})
This creates a nice map but with two missing districts:
In data_district
those rows show like this:
district cap_rate
Lo Espejo np.nan
Colina np.nan
And they are included in the geojson data, too. How would I go to color those districts?
Thanks !