numpy.ndindex

class numpy.ndindex(*args)

Pass in a sequence of integers corresponding to the number of dimensions in the counter. This iterator will then return an N-dimensional counter.

Example: >>> 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)

Previous topic

numpy.ndenumerate

Next topic

numpy.flatiter

This Page

Quick search