小编cla*_*ams的帖子

为什么我的 geopandas 安装缺少 sjoin?AttributeError:“GeoDataFrame”对象没有属性“sjoin”

我需要在项目中使用 geopandas sjoin 。我已经成功创建了 GeoDataFrame 对象并使用了类方法 readfile、crs 和 to_crs。但是,当涉及到使用 sjoin 时,我收到错误: AttributeError: 'GeoDataFrame' object has no attribute 'sjoin'。

所以我想我会尝试让 sjoin 处理一个直接取自 geopandas 官方网站的简单示例: https: //geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.sjoin.html

import geopandas

countries = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
cities = geopandas.read_file(geopandas.datasets.get_path("naturalearth_cities"))
print(countries.head())
print(cities.head())

cities_w_country_data = cities.sjoin(countries)
print(cities_w_country_data.head())
Run Code Online (Sandbox Code Playgroud)

但我遇到了同样的问题。请问有人可以解释这个错误并提供解决方案吗?谢谢。

输出如下:

C:\Users\mmm\AppData\Local\ESRI\conda\envs\arcgispro-py3_clone\lib\site-packages\geopandas\array.py:85: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  aout[:] = out
C:\Users\mmm\AppData\Local\ESRI\conda\envs\arcgispro-py3_clone\lib\site-packages\geopandas\geodataframe.py:35: ShapelyDeprecationWarning: The …
Run Code Online (Sandbox Code Playgroud)

python arcgis geopandas

9
推荐指数
1
解决办法
4517
查看次数

标签 统计

arcgis ×1

geopandas ×1

python ×1