Skip to content

Commit

Permalink
DOC: Add return value for Index.slice_locs when label not found panda…
Browse files Browse the repository at this point in the history
…s-dev#32680 (pandas-dev#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
  • Loading branch information
KeiOshima authored and pmhatre1 committed May 7, 2024
1 parent 1ab7ac8 commit 87b1934
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 87b1934

Please sign in to comment.