【发布时间】:2019-01-18 04:24:11
【问题描述】:
我想使用geopandas.rotate() 函数根据列中的属性旋转geodataframe 中的所有特征。如果我只选择一个功能,我就成功了。但是对于多行,我相信我需要创建一个 for 循环。
new_gdf = gpd.GeoDataFrame(columns=foo.columns)
for index, row in foo.iterrows():
bar = foo[foo[row]].rotate(foo[rotation_col], origin='center')
new_gdf=new_gdf.append(bar)
当我尝试编写 for 循环时,我得到一个类型错误 unhashable type:'Polygon'。我还尝试编写.apply() 函数。我不确定我做对了。但这就是我所拥有的:
foo_new = foo.apply(foo.rotate(foo.rotation_col, origin='center'))
我可以根据需要提供更多信息。
谢谢
【问题讨论】:
标签: python pandas gis geopandas