geopandas.GeoSeries.cx#
- property GeoSeries.cx[来源]#
基于坐标的索引器,通过与边界框相交来选择。
输入格式应为
.cx[xmin:xmax, ymin:ymax]。可以提供任意的xmin、xmax、ymin和ymax,但输入 必须包含一个逗号用于分隔 x 和 y 切片。也就是说,.cx[:, :]将返回整个序列/数据框,但.cx[:]尚未实现。示例
>>> from shapely.geometry import LineString, Point >>> s = geopandas.GeoSeries( ... [Point(0, 0), Point(1, 2), Point(3, 3), LineString([(0, 0), (3, 3)])] ... ) >>> s 0 POINT (0 0) 1 POINT (1 2) 2 POINT (3 3) 3 LINESTRING (0 0, 3 3) dtype: geometry
>>> s.cx[0:1, 0:1] 0 POINT (0 0) 3 LINESTRING (0 0, 3 3) dtype: geometry
>>> s.cx[:, 1:] 1 POINT (1 2) 2 POINT (3 3) 3 LINESTRING (0 0, 3 3) dtype: geometry