plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Fix GeoPandas dataset compatibility for naturalearth_cities

Open AliAbouelazm opened this issue 1 month ago • 3 comments

Closes #5289

Update documentation examples to support both GeoPandas < 1.0 and >= 1.0.

Context: GeoPandas 1.0 removed the datasets accessor used in gpd.datasets.get_path("naturalearth_cities").

Changes:

  • Try old method first for backward compatibility
  • Fallback to geodatasets package for GeoPandas >= 1.0
  • Final fallback to a public GeoJSON URL if geodatasets is not available

Files updated:

  • doc/python/scatter-plots-on-maps.md
  • doc/python/tile-scatter-maps.md

Docs-only change.

AliAbouelazm avatar Nov 16 '25 01:11 AliAbouelazm

Thanks for the PR! We'll try to review this as we have time. This seems to be related to #4782.

camdecoster avatar Nov 17 '25 21:11 camdecoster

@LiamConnors Any reason not to simply require geopandas>=1.0? I'm not sure if we need to provide examples for both old and new geopandas.

emilykl avatar Nov 24 '25 23:11 emilykl

@LiamConnors Any reason not to simply require geopandas>=1.0? I'm not sure if we need to provide examples for both old and new geopandas.

I agree. It doesn't need to be compatible with old geopandas. Instead of having an example that creates theGeoDataFrame in the code, it would also be fine to just use one of the available datasets in geodatasets even if that won't work with earlier versions of geopandas.

LiamConnors avatar Nov 25 '25 15:11 LiamConnors