pandas 1.4.2

NotesParametersRaisesReturns
slice_indexer(self, start: 'Hashable | None' = None, end: 'Hashable | None' = None, step: 'int | None' = None, kind=<no_default>) -> 'slice'

Index needs to be ordered and unique.

Notes

This function assumes that the data is sorted, so use at your own peril

Parameters

start : label, default None

If None, defaults to the beginning.

end : label, default None

If None, defaults to the end.

step : int, default None
kind : str, default None
deprecated

Raises

KeyError : If key does not exist, or key is not unique and index is

not ordered.

Returns

indexer : slice

Compute the slice indexer for input labels and step.

Examples

This is a method on all index types. For example you can do:

This example is valid syntax, but we were not able to check execution
>>> idx = pd.Index(list('abcd'))
... idx.slice_indexer(start='b', end='c') slice(1, 3, None)
This example is valid syntax, but we were not able to check execution
>>> idx = pd.MultiIndex.from_arrays([list('abcd'), list('efgh')])
... idx.slice_indexer(start='b', end=('c', 'g')) slice(1, 3, None)
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/base.py#6224
type: <class 'function'>
Commit: