Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update geopandas example to support versions >=1.0 (fixes issue #4778)
  • Loading branch information
Sarthak Khanna committed Oct 7, 2024
commit b509b4a6cbb712248e96c89d442c37412cdbec5c
12 changes: 8 additions & 4 deletions doc/python/scatter-plots-on-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ fig.show()
import plotly.express as px
import geopandas as gpd

geo_df = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
if gpd.__version__ < '1.0':
geo_df = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
else:
import geodatasets
geo_df = gpd.read_file(geodatasets.get_path('naturalearth_cities'))

px.set_mapbox_access_token(open(".mapbox_token").read())
fig = px.scatter_geo(geo_df,
lat=geo_df.geometry.y,
lon=geo_df.geometry.x,
hover_name="name")
lat=geo_df.geometry.y,
lon=geo_df.geometry.x,
hover_name="name")
fig.show()
```

Expand Down