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
GeoDataFrame objects. For more information on indexing/selecting, see the pandas documentation.
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
GeoDataFrame that intersect the
bounding box will be returned.
world dataset, we can use this functionality to quickly select all
countries whose boundaries extend into the southern hemisphere.
In : world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) In : southern_world = world.cx[:, :0] In : southern_world.plot(figsize=(10, 3));