A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/docs/dev/user_guide/../reference/api/pandas.Index.get_slice_bound.html below:

pandas.Index.get_slice_bound — pandas 3.0.0.dev0+2231.g4f2aa4d2be documentation

pandas.Index.get_slice_bound#
Index.get_slice_bound(label, side)[source]#

Calculate slice bound that corresponds to given label.

Returns leftmost (one-past-the-rightmost if side=='right') position of given label.

Parameters:
labelobject

The label for which to calculate the slice bound.

side{‘left’, ‘right’}

if ‘left’ return leftmost position of given label. if ‘right’ return one-past-the-rightmost position of given label.

Returns:
int

Index of label.

See also

Index.get_loc

Get integer location, slice or boolean mask for requested label.

Examples

>>> idx = pd.RangeIndex(5)
>>> idx.get_slice_bound(3, "left")
3
>>> idx.get_slice_bound(3, "right")
4

If label is non-unique in the index, an error will be raised.

>>> idx_duplicate = pd.Index(["a", "b", "a", "c", "d"])
>>> idx_duplicate.get_slice_bound("a", "left")
Traceback (most recent call last):
KeyError: Cannot get left slice bound for non-unique label: 'a'

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4