Skip to content

Commit ec3eddd

Browse files
authored
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
1 parent 05ab1af commit ec3eddd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/core/indexes/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -6453,6 +6453,10 @@ def slice_locs(self, start=None, end=None, step=None) -> tuple[int, int]:
64536453
>>> idx = pd.Index(list("abcd"))
64546454
>>> idx.slice_locs(start="b", end="c")
64556455
(1, 3)
6456+
6457+
>>> idx = pd.Index(list("bcde"))
6458+
>>> idx.slice_locs(start="a", end="c")
6459+
(0, 2)
64566460
"""
64576461
inc = step is None or step >= 0
64586462

0 commit comments

Comments
 (0)