bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / ndindex
class
numpy:ndindex
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/__init__.py
Signature
class ndindex ( * shape ) Summary
An N-dimensional iterator object to index arrays.
Extended Summary
Given the shape of an array, an ndindex instance iterates over the N-dimensional index of the array. At each iteration a tuple of indices is returned, the last dimension is iterated over first.
Parameters
shape: ints, or a single tuple of intsThe size of each dimension of the array can be passed as individual parameters or as the elements of a tuple.
Examples
import numpy as np
✓for index in np.ndindex(3, 2, 1): print(index)✓
for index in np.ndindex((3, 2, 1)): print(index)✓
See also
- flatiter
- ndenumerate
Aliases
-
numpy.ndindex