numpy.where
Robert Kern
robert.kern at gmail.com
Fri Apr 10 03:39:46 EDT 2009
On 2009-04-09 22:40, Peter Pearson wrote:
> 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 . . .
http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list