Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/source/user_guide/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,17 @@ above example, ``s.loc[1:6]`` would raise ``KeyError``.
For the rationale behind this behavior, see
:ref:`Endpoints are inclusive <advanced.endpoints_are_inclusive>`.

.. ipython:: python

s = pd.Series(list('abcdef'), index=[0, 3, 2, 5, 4, 2])
s.loc[3:5]

Also, if the index has duplicate labels *and* either the start or the stop labels is dupulicate labels,
an error will be raised. For instance, in the above example, ``s.loc[2:5]`` would raise ``KeyError``.

For more information about duplicate labels, see
:ref:`Duplicate Labels <duplicates>`.

.. _indexing.integer:

Selection by position
Expand Down