[Numpy-discussion] enumerate indices and values of a multidimensionnal numarray.array
Chris Barker
Chris.Barker at noaa.gov
Wed Nov 2 09:44:07 CST 2005
There was a discussion about this last month:
http://aspn.activestate.com/ASPN/Mail/Message/numpy-discussion/2850560
You should get some good ideas from that.
-Chris
Philou wrote:
> 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
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Numpy-discussion
mailing list