[Numpy-discussion] enumerate indices and values of a multidimensionnal numarray.array

Philou Kalimeroc5 at wanadoo.fr
Wed Nov 2 07:34:07 CST 2005


Hi list,
I'm a new subsciber to this numpy list.

I have a multidimensionnal array (>2).
For example:
x = numarray.array([[[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]]])

print x
[[[1 2 3]
  [4 5 6]]

 [[1 2 3]
  [4 5 6]]]

I need to enumerate both indices and final values (1D) of the x array.
So i need:
(0,0,0) 1
(0,0,1) 2
(0,0,2) 2
(0,1,0) 4
(0,1,1) 5
(0,1,2) 6
(1,0,0) 1
(1,0,1) 2

How can i do without using the x.flat() method?

Thanks a lot for the answer.
regards,
Philippe Collet






More information about the Numpy-discussion mailing list