A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://geopandas.readthedocs.io/en/latest/docs/user_guide/indexing.html below:

Indexing and selecting data — GeoPandas 1.1.1+7.g355d44d.dirty documentation

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.

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.

Using the geoda.chile_labor dataset, you can use this functionality to quickly select parts of Chile whose boundaries extend south of the -50 degrees latitude. You can first check the original GeoDataFrame.

In [1]: import geodatasets

In [2]: chile = geopandas.read_file(geodatasets.get_path('geoda.chile_labor'))

In [3]: chile.plot(figsize=(8, 8));

And then select only the southern part of the country.

In [4]: southern_chile = chile.cx[:, :-50]

In [5]: southern_chile.plot(figsize=(8, 8));

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4