巴黎:区与自行车站的空间连接
回到巴黎的行政区与自行车站数据。现在我们将使用空间连接操作,识别每个站点所在的行政区。
行政区与共享单车站点两个数据集已分别预加载为 districts 与 stations 两个 GeoDataFrame,且已将 GeoPandas 以 geopandas 导入。
本练习是课程的一部分
在 Python 中处理地理空间数据
练习说明
- 使用
geopandas.sjoin()函数,将每个站点所在的行政区名称添加到stations数据集中。将结果命名为joined。 - 通过显示前 5 行来检查结果。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Join the districts and stations datasets
joined = ____
# Inspect the first five rows of the result
print(joined.____)