Name

indices

Synopsis

indices(shapetuple,typecode=None)

Returns an integer array x of shape (len( shapetuple ),)+ shapetuple. Each element of subarray x [ i ] is equal to the element’s i index in the subarray. For example:

print Numeric.indices((2,4))     # prints: [[[0 0 0 0]
                                 #           [1 1 1 1]]
                                 #          [[0 1 2 3]
                                 #           [0 1 2 3]]]

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.