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.00000 0.00000) 1 POINT (1.00000 2.00000) 2 POINT (3.00000 3.00000) 3 LINESTRING (0.00000 0.00000, 3.00000 3.00000) dtype: geometry
>>> s.cx[0:1, 0:1] 0 POINT (0.00000 0.00000) 3 LINESTRING (0.00000 0.00000, 3.00000 3.00000) dtype: geometry
>>> s.cx[:, 1:] 1 POINT (1.00000 2.00000) 2 POINT (3.00000 3.00000) 3 LINESTRING (0.00000 0.00000, 3.00000 3.00000) dtype: geometry