numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturns
_as_pairs(x, ndim, as_index=False)

A helper function for pad that prepares and validates arguments like :None:None:`pad_width` for iteration in pairs.

Parameters

x : {None, scalar, array-like}

The object to broadcast to the shape (ndim , 2).

ndim : int

Number of pairs the broadcasted x will have.

as_index : bool, optional

If x is not None, try to round each element of x to an integer (dtype :None:None:`np.intp`) and ensure every element is positive.

Raises

ValueError

If :None:None:`as_index` is True and x contains negative elements. Or if x is not broadcastable to the shape (ndim , 2).

Returns

pairs : nested iterables, shape (`ndim`, 2)

The broadcasted version of x.

Broadcast x to an array with the shape (ndim , 2).

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


GitHub : /numpy/lib/arraypad.py#454
type: <class 'function'>
Commit: