Skip to content

Commit af7f2ef

Browse files
pilkibunjorisvandenbossche
pilkibun
authored andcommitted
DOC: add internal links to "Endpoints are inclusive" section (#27131)
1 parent 734b6d1 commit af7f2ef

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

doc/source/user_guide/advanced.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,8 @@ the :meth:`~Index.is_unique` attribute.
11081108
weakly_monotonic.is_monotonic_increasing
11091109
weakly_monotonic.is_monotonic_increasing & weakly_monotonic.is_unique
11101110
1111+
.. _advanced.endpoints_are_inclusive:
1112+
11111113
Endpoints are inclusive
11121114
~~~~~~~~~~~~~~~~~~~~~~~
11131115

@@ -1137,7 +1139,7 @@ index can be somewhat complicated. For example, the following does not work:
11371139
s.loc['c':'e' + 1]
11381140

11391141
A very common use case is to limit a time series to start and end at two
1140-
specific dates. To enable this, we made the design to make label-based
1142+
specific dates. To enable this, we made the design choice to make label-based
11411143
slicing include both endpoints:
11421144

11431145
.. ipython:: python

doc/source/user_guide/indexing.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ of multi-axis indexing.
6161
* A list or array of labels ``['a', 'b', 'c']``.
6262
* A slice object with labels ``'a':'f'`` (Note that contrary to usual python
6363
slices, **both** the start and the stop are included, when present in the
64-
index! See :ref:`Slicing with labels
65-
<indexing.slicing_with_labels>`.).
64+
index! See :ref:`Slicing with labels <indexing.slicing_with_labels>`
65+
and :ref:`Endpoints are inclusive <advanced.endpoints_are_inclusive>`.)
6666
* A boolean array
6767
* A ``callable`` function with one argument (the calling Series or DataFrame) and
6868
that returns valid output for indexing (one of the above).
@@ -335,8 +335,7 @@ The ``.loc`` attribute is the primary access method. The following are valid inp
335335
* A list or array of labels ``['a', 'b', 'c']``.
336336
* A slice object with labels ``'a':'f'`` (Note that contrary to usual python
337337
slices, **both** the start and the stop are included, when present in the
338-
index! See :ref:`Slicing with labels
339-
<indexing.slicing_with_labels>`.).
338+
index! See :ref:`Slicing with labels <indexing.slicing_with_labels>`.
340339
* A boolean array.
341340
* A ``callable``, see :ref:`Selection By Callable <indexing.callable>`.
342341

@@ -418,6 +417,9 @@ error will be raised (since doing otherwise would be computationally expensive,
418417
as well as potentially ambiguous for mixed type indexes). For instance, in the
419418
above example, ``s.loc[1:6]`` would raise ``KeyError``.
420419

420+
For the rationale behind this behavior, see
421+
:ref:`Endpoints are inclusive <advanced.endpoints_are_inclusive>`.
422+
421423
.. _indexing.integer:
422424

423425
Selection by position

0 commit comments

Comments
 (0)