无法使用pysal打开形状文件

can't open a shape file with pysal

我尝试使用带有该代码的 pyyaml 打开一个文件:

import pysal
f=pysal.open()

这是我得到的回复:

AttributeError: module 'pysal' has no attribute 'open'

我做错了什么?

pysal 发布了版本 2 的重大更改。open 不再是顶级导入。

您仍然可以使用 pysal 打开 shapefile,但您需要先导入 pysal.lib.io.open

进口pysal.lib.io.open pysal.lib.io.open('Path/to/file.shp')