[Numpy-discussion] np.choose() question
Gökhan Sever
gokhansever at gmail.com
Tue Jun 8 15:44:29 EDT 2010
On Tue, Jun 8, 2010 at 2:32 PM, Hans Meine
<meine at informatik.uni-hamburg.de>wrote:
>
>
> 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.
--
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100608/f5446194/attachment.html>
More information about the NumPy-Discussion
mailing list