Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 09:00 AM
@Keval Shah :
There could be several reasons why the choropleth map is not rendering in your Jupyter notebook. Here are a few things you could try:
- Check that the GeoJSON file is loaded correctly: Make sure that the GeoDataFrame has been loaded correctly by checking the output of gpd.read_file(geojson_file)
- Check the GeoDataFrame index: The locations argument in px.choropleth_mapbox expects a list of strings or numbers representing the index of the GeoDataFrame. Make sure that the index is set and that it is of the correct type.
- Check that the color column exists: Make sure that the column specified in the color argument exists in the GeoDataFrame.
- Check that Mapbox API token is set: In order to display the map, you need to have a valid Mapbox API token. Make sure that you have set this token using mapbox_token environment variable, or by passing it directly to px.choropleth_mapbox
- Check that your internet connection is working: If you are using Mapbox as a basemap, you need an internet connection to load the map tiles. Make sure that you have a stable internet connection and that there are no issues with your firewall or network settings.
- You can also try adding fig.show() at the end of the code to display the map in a separate window, rather than inline in the Jupyter notebook.
If none of these solutions work, you could try using a different library to render the choropleth map, such as Folium or Bokeh.