我使用 pysal/cenpy 提取地理信息,但对象通过调用质心返回错误
import cenpy as cen
import pysal as ps
import geopandas as gpd
dataset = 'ACSSF5Y2015'
con = cen.base.Connection(dataset)
con.set_mapservice('tigerWMS_ACS2017')
geotmp = con.mapservice.query(layer=84, where='STATE=' + str(1))
type(geotmp)
#pandas.core.frame.DataFrame
type(geotmp.geometry[0])
#pysal.cg.shapes.Polygon
geotmp.geometry.centroid
AttributeError: 'Series' object has no attribute 'centroid'
在gds-scipy16的内置数据集上检查了相同的内容
type(data_table)
#pandas.core.frame.DataFrame
type(data_table.geometry[0])
#pysal.cg.shapes.Polygon
data_table.geometry[0].centroid
#(-94.90336786329912, 48.771730563701574)
如何纠正错误?