numpy.where
Peter Pearson
ppearson at nowhere.invalid
Thu Apr 9 23:40:55 EDT 2009
On Thu, 09 Apr 2009 09:09:18 -0400, Lou Pecora wrote:
>
> Thanks, Neil. Always something to learn. I've used Numpy for several
> years, but still have not plumbed the depths. Just tried this script
> and, yep, it works.
>
> arr=array([-1,1.0,2.2,-10.0,1.1, 0.9,-0.9])
> cond= arr < 1.0
> print cond
> brr=arr[cond]
> print brr
>
> Output:
>
> [ True False False True False True True]
> [ -1. -10. 0.9 -0.9]
>
> Really, I've gotta RTFM. :-)
Hey, if you find TFM, please tell me where it is. I haven't
found anything Fine. I even bought Travis Oliphant's book,
which helps a little, but . . .
--
To email me, substitute nowhere->spamcop, invalid->net.
More information about the Python-list
mailing list