0

我正在尝试对 shapefile(shp) 执行空间自相关函数。我如何为此生成女王邻接?

我阅读了 pysal 文档并看到了“queen_from_shapefile”,但出现错误。

这是我的代码:

shp= gpd.read_file(r'..\data\districts.shp')
Q_w = ps.queen_from_shapefile(shp)

我不断得到的错误是

AttributeError: module 'pysal' has no attribute 'queen_from_shapefile'
4

1 回答 1

0

您可以使用以下脚本从 Geopandas GeoDataFrame 生成 Queen 连续性:

Q_w = ps.lib.weights.Queen.from_dataframe(shp)

queen_from_shapefile不相关,因为无论如何您都在通过 gdf。我认为它不再使用,文档可能已过时。

于 2019-10-09T21:31:04.443 回答