From 87b1934cd229c623f53e84a50d97218fa888aece Mon Sep 17 00:00:00 2001 From: KeiOshima Date: Wed, 3 Apr 2024 17:36:34 -0400 Subject: [PATCH] DOC: Add return value for Index.slice_locs when label not found #32680 (#58135) * add return value if non-existent label is provided in pandas.Index.slice_locs * fix Line too long error * remove trailing whitespace * fix double line break * writing as example instead of note --- pandas/core/indexes/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 41d370ec8ece7..7a5743a6de0c0 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -6434,6 +6434,10 @@ def slice_locs(self, start=None, end=None, step=None) -> tuple[int, int]: >>> idx = pd.Index(list("abcd")) >>> idx.slice_locs(start="b", end="c") (1, 3) + + >>> idx = pd.Index(list("bcde")) + >>> idx.slice_locs(start="a", end="c") + (0, 2) """ inc = step is None or step >= 0