PYTHON 练习笔记(三)索引和选择数据

Indexing and Selecting Data

GeoPandas inherits the standard pandas methods for indexing/selecting data. This includes label based indexing with .loc and integer position based indexing with .iloc, which apply to both GeoSeries and GeoDataFrame objects. For more information on indexing/selecting, see the pandas documentation.

GeoPandas继承了用于索引/选择数据的标准pandas方法。 这包括使用.loc进行基于标签的索引和使用.iloc进行基于整数位置的索引,这些索引适用于GeoSeries和GeoDataFrame对象。 有关索引/选择的更多信息,请参阅pandas文档。

In addition to the standard pandas methods, GeoPandas also provides coordinate based indexing with the cx indexer, which slices using a bounding box. Geometries in the GeoSeries or GeoDataFrame that intersect the bounding box will be returned.

除了标准的pandas方法之外,GeoPandas还为cx索引器提供基于坐标的索引,cx索引器使用边界框进行切片。 将返回与边界框相交的GeoSeries或GeoDataFrame中的几何图形。

Using the world dataset, we can use this functionality to quickly select all countries whose boundaries extend into the southern hemisphere.

使用世界数据集,我们可以使用此功能快速选择所有边界延伸到南半球的国家/地区。

In [1]: world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))

In [2]: southern_world = world.cx[:, :0]

In [3]: southern_world.plot(figsize=(10, 3));

_images/world_southern.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值