Files
geopandas/doc/source/docs/user_guide/indexing.rst
T
Martin Fleischmann 953753896a DOC: Restructured documentation, use pydata-sphinx-theme (#1564)
* use pydata theme

* structure

* fix links

* adapt colors

* getting started

* buttons

* buttons

* rename, use myst, fill stuff

* myst to env

* cleanup

* covered_by

* review comments

* fix link

* use api
2020-08-20 21:48:19 +01:00

31 lines
1.1 KiB
ReStructuredText

.. currentmodule:: geopandas
.. ipython:: python
:suppress:
import geopandas
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.
.. _pandas: http://pandas.pydata.org/pandas-docs/stable/indexing.html
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 ``world`` dataset, we can use this functionality to quickly select all
countries whose boundaries extend into the southern hemisphere.
.. ipython:: python
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
southern_world = world.cx[:, :0]
@savefig world_southern.png
southern_world.plot(figsize=(10, 3));