[Numpy-discussion] np.choose() question

Gökhan Sever gokhansever@gmail....
Tue Jun 8 14:44:29 CDT 2010

On Tue, Jun 8, 2010 at 2:32 PM, Hans Meine
> Funny, that's exactly what I wanted to do (idx being a label/region image
> here),
> and what I tried today.
> You will be happy to hear that the even simpler solution is to just use
> fancy indexing (the name is justified here):
>  times[idx]
> will do the trick, too - no nead to flatten & reshape at all! :-)
> (Given that both are ndarrays of course.)

You have got the bonus points Hans!

I have a special ability to drag myself into list comprehensions for array
indexing questions. Numpy provides such simple operations where mortals like
me skip over easily or forget to convert lists as arrays before trying them.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100608/f5446194/attachment.html 

More information about the NumPy-Discussion mailing list