numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersBackRef

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 ints

The size of each dimension of the array can be passed as individual parameters or as the elements of a tuple.

An N-dimensional iterator object to index arrays.

See Also

flatiter
ndenumerate

Examples

Dimensions as individual arguments

>>> for index in np.ndindex(3, 2, 1):
...  print(index) (0, 0, 0) (0, 1, 0) (1, 0, 0) (1, 1, 0) (2, 0, 0) (2, 1, 0)

Same dimensions - but in a tuple (3, 2, 1)

>>> for index in np.ndindex((3, 2, 1)):
...  print(index) (0, 0, 0) (0, 1, 0) (1, 0, 0) (1, 1, 0) (2, 0, 0) (2, 1, 0)
See :

Back References

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

numpy.take_along_axis numpy.take numpy.apply_along_axis numpy.ndindex numpy.put_along_axis numpy.ma.extras.apply_along_axis numpy.ndenumerate

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/__init__.py#None
type: <class 'type'>
Commit: