pandas 1.4.2

ParametersRaisesReturns
maybe_convert_indices(indices, n: 'int', verify: 'bool' = True)

If we have negative indices, translate to positive here. If we have indices that are out-of-bounds, raise an IndexError.

Parameters

indices : array-like

Array of indices that we are to convert.

n : int

Number of elements in the array that we are indexing.

verify : bool, default True

Check that all entries are between 0 and n - 1, inclusive.

Raises

IndexError

One of the converted indices either exceeded the number of, elements (specified by n), or was still negative.

Returns

array-like

An array-like of positive indices that correspond to the ones that were passed in initially to this function.

Attempt to convert indices into valid, positive indices.

Examples

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/indexers/utils.py#249
type: <class 'function'>
Commit: