Files
geopandas/doc/source/docs/user_guide/indexing.rst
T
Murat Can ÜsteandMartin Fleischmann e2c5b0d978 DOC: Relevant API links for intersphinx mapping (#1931)
* DOC: added API links to intersphinx mapping

* DOC: updated mergingdata.rst links

* DOC: updated aggregation_with_dissolve.rst links

* DOC: updated data_structures.rst links

* DOC: updated geocoding.rst links

* DOC: updated geometric_manipulations.rst links

* DOC: updated indexing.rst links

* DOC: updated io.rst links

* DOC: updated projections.rst links

* DOC: updated set_operations.rst links

* DOC: updated mapping.rst links

* DOC: updated missing_empty.rst links

* DOC: updated geoplot intersphinx links

* DOC: make 'unary_union' attr instead of method

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: remove link to GeoDataFrame.geometry

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: convert pandas indexers to attrs instead of methods

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: convert indexer 'cx' to attr instead of method

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: refer GeoSeries.buffer instead of shapely buffer

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: make 'unary_union' attr instead of method on missing_empty.rst

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: refer to DataFrame.merge instead of pandas.merge

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

* DOC: link pyproj.CRS

* DOC: changed API links to 'stable' from 'latest'

* DOC: fixed separator length

* DOC: uppercase CRS in pyproj.crs

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
2021-05-28 11:16:54 +01:00

30 lines
1.2 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 :attr:`~pandas.DataFrame.loc` and integer position based indexing with :attr:`~pandas.DataFrame.iloc`, which apply to both :class:`GeoSeries` and :class:`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 :attr:`~GeoDataFrame.cx` indexer, which slices using a bounding
box. Geometries in the :class:`GeoSeries` or :class:`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));