bundles / numpy 2.4.3 / numpy / lib / _arraypad_impl / _as_pairs
function
numpy.lib._arraypad_impl:_as_pairs
Signature
def _as_pairs ( x , ndim , as_index = False ) Summary
Broadcast x to an array with the shape (ndim, 2).
Extended Summary
A helper function for pad that prepares and validates arguments like pad_width for iteration in pairs.
Parameters
x: {None, scalar, array-like}The object to broadcast to the shape (
ndim, 2).ndim: intNumber of pairs the broadcasted
xwill have.as_index: bool, optionalIf
xis not None, try to round each element ofxto an integer (dtypenp.intp) and ensure every element is positive.
Returns
pairs: nested iterables, shape (`ndim`, 2)The broadcasted version of
x.
Raises
: ValueErrorIf
as_indexis True andxcontains negative elements. Or ifxis not broadcastable to the shape (ndim, 2).
Aliases
-
numpy.lib._arraypad_impl._as_pairs