【发布时间】:2018-09-05 09:22:06
【问题描述】:
将 geopandas 地理数据框转换为 pandas 数据框的最有效方法是什么?以下是我使用的方法,是否还有另一种更有效或更好地不产生错误的方法?
import geopandas as gpd
import pandas as pd
# assuming I have a shapefile named shp1.shp
gdf1 = gpd.read_file('shp1.shp')
# then for the conversion, I drop the last column (geometry) and specify the column names for the new df
df1 = pd.DataFrame(gdf1.iloc[:,:-1].values, columns = list(gdf1.columns.values)[:-1] )
【问题讨论】: