嗨,我正在将Anaconda与Python 3.7一起使用,并且已经将Pysal导入了我的环境。现在,我尝试导入数据集并使用pysal打开它,令我惊讶的是pysal似乎没有打开属性...
import pysal as ps
import libpysal as lps
lps.examples.explain('us_income')
csv_path = lps.examples.get_path('usjoin.csv')
f = ps.open(csv_path)
我遇到错误AttributeError: module 'pysal' has no attribute 'open'
我该如何解决?
答案 0 :(得分:1)
可以使用修改后的脚本访问示例数据集;
# Import packages
import pysal as ps
import libpysal as lps
# Load example data
lps.examples.explain('us_income')
csv_path = lps.examples.get_path('usjoin.csv')
# Note the difference here
f = ps.lib.io.open(csv_path)
这些更改是PySAL migrating to 2.0的结果。假设您使用的是PySAL> = 2.0。如果此回答您的问题,请标记为正确。