pandas 1.4.2

ParametersReturnsBackRef
take_nd(arr: 'ArrayLike', indexer, axis: 'int' = 0, fill_value=<no_default>, allow_fill: 'bool' = True) -> 'ArrayLike'

This dispatches to take defined on ExtensionArrays. It does not currently dispatch to SparseArray.take for sparse arr .

Note: this function assumes that the indexer is a valid(ated) indexer with no out of bound indices.

Parameters

arr : np.ndarray or ExtensionArray

Input array.

indexer : ndarray

1-D array of indices to take, subarrays corresponding to -1 value indices are filed with fill_value

axis : int, default 0

Axis to take from

fill_value : any, default np.nan

Fill value to replace -1 values with

allow_fill : bool, default True

If False, indexer is assumed to contain no -1 values so no filling will be done. This short-circuits computation of a mask. Result is undefined if allow_fill == False and -1 is present in indexer.

Returns

subarray : np.ndarray or ExtensionArray

May be the same type as the input, or cast to an ndarray.

Specialized Cython take which sets NaN values in one pass

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.array_algos.take.take_1d

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/array_algos/take.py#57
type: <class 'function'>
Commit: