【问题标题】:Is there an add on for the pysal library for generating a queen contiguity?pysal 库是否有用于生成皇后邻接的附加组件?
【发布时间】:2020-01-18 18:14:06
【问题描述】:

我正在尝试对 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'

【问题讨论】:

    标签: python correlation pysal


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2017-03-14
      • 2010-10-22
      • 2010-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-12
      • 1970-01-01
      相关资源
      最近更新 更多