pandas 1.4.2

NotesParametersReturns
get_slice_bound(self, label: 'Hashable | Sequence[Hashable]', side: 'str', kind=<no_default>) -> 'int'

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

Notes

This method only works if level 0 index of the MultiIndex is lexsorted.

Parameters

label : object or tuple of objects
side : {'left', 'right'}
kind : {'loc', 'getitem', None}
deprecated

Returns

int

Index of label.

For an ordered MultiIndex, compute slice bound that corresponds to given label.

See Also

MultiIndex.get_loc

Get location for a label or a tuple of labels.

MultiIndex.get_locs

Get location for a label/slice/list/mask or a sequence of such.

Examples

This example is valid syntax, but we were not able to check execution
>>> mi = pd.MultiIndex.from_arrays([list('abbc'), list('gefd')])

Get the locations from the leftmost 'b' in the first level until the end of the multiindex:

This example is valid syntax, but we were not able to check execution
>>> mi.get_slice_bound('b', side="left")
1

Like above, but if you get the locations from the rightmost 'b' in the first level and 'f' in the second level:

This example is valid syntax, but we were not able to check execution
>>> mi.get_slice_bound(('b','f'), side="right")
3
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/indexes/multi.py#2622
type: <class 'function'>
Commit: