On 1/18/2014 3:50 AM, Peter Otten wrote:
Unlike `&` `and` cannot be overridden (*),
(*) I assume overriding would collide with short-cutting of boolean
expressions.
Yes. 'and' could be called a 'control-flow operator', but in Python it
is not a functional operator.
A functional binary op
Peter Otten <__pete...@web.de> wrote:
>John Ladasky wrote:
>
>> On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote:
>>
>>> >>> a = np.arange(10)
>>> >>> c = np.where((2 < a) & (a < 7))
>>> >>> c
>>> (array([3, 4, 5, 6]),)
>>
>> Nice! Thanks!
>>
>> Now, why does the multiple co
John Ladasky wrote:
> On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote:
>
>> >>> a = np.arange(10)
>> >>> c = np.where((2 < a) & (a < 7))
>> >>> c
>> (array([3, 4, 5, 6]),)
>
> Nice! Thanks!
>
> Now, why does the multiple comparison fail, if you happen to know?
2 < a < 7
i
On Friday, January 17, 2014 6:16:28 PM UTC-8, duncan smith wrote:
> >>> a = np.arange(10)
> >>> c = np.where((2 < a) & (a < 7))
> >>> c
> (array([3, 4, 5, 6]),)
Nice! Thanks!
Now, why does the multiple comparison fail, if you happen to know?
--
https://mail.python.org/mailman/listinfo/pyth
numpy.where() to select parts of arrays. I have encountered what
I would consider to be a bug when you try to use where() in conjunction with
the multiple comparison syntax of Python. Here's a minimal example:
Python 3.3.2+ (default, Oct 9 2013, 14:50:09)
[GCC 4.8.1] on linux
Type
Hi folks,
I am awaiting my approval to join the numpy-discussion mailing list, at
scipy.org. I realize that would be the best place to ask my question.
However, numpy is so widely used, I figure that someone here would be able to
help.
I like to use numpy.where() to select parts of arrays
In article <747te7f1209a...@mid.individual.net>,
Peter Pearson wrote:
> On Thu, 09 Apr 2009 09:09:18 -0400, Lou Pecora wrote:
> >
> > 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,
> wh
In article ,
Robert Kern wrote:
> http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
That helps, thanks. So I can RTFWP, too. :-)
--
-- Lou Pecora
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 10 Apr 2009 02:39:46 -0500, Robert Kern wrote:
> On 2009-04-09 22:40, Peter Pearson wrote:
>>
>> 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/nump
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
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 <
On Apr 9, 2:58 am, Neil Crighton wrote:
> Carl Banks gmail.com> writes:
>
> > > >>> condition = (min_time <= time) & (time <= max_time)
> > > >>> new_time = time[condition]
> > > >>> new_energy = energy[condition]
>
> > Won't work: condition is an array of ones and zeros, but you need to
> > inde
In article ,
Neil Crighton wrote:
>
> I'm not sure exactly what you're trying to do, but maybe you want a boolean
> array to select the right elements? So if time and energy are 1-d numpy arrays
> of the same length:
>
> >>> condition = (min_time <= time) & (time <= max_time)
> >>> new_time =
Carl Banks gmail.com> writes:
> > >>> condition = (min_time <= time) & (time <= max_time)
> > >>> new_time = time[condition]
> > >>> new_energy = energy[condition]
>
> Won't work: condition is an array of ones and zeros, but you need to
> index the arrays with indices. So, add a call to nonzero
> to cut both arrays of time
>
> min<=time<=max . I've created a 2d array> with [time,energy] and I believe
> numpy.where is what I am looking for, but
>
> haven't been able to get the
>
> > conditions in right for it to work.
>
> I'
ted a 2d array
> with [time,energy] and I believe numpy.where is what I am looking for, but
haven't been able to get the
> conditions in right for it to work.
I'm not sure exactly what you're trying to do, but maybe you want a boolean
array to select the right elements? So if
Hi,
I'm fairly new to programming and am having a probably cutting my arrays. I
have two different 1d arrays, one of time, and the second energy.I want to
cut both arrays of time min<=time<=max . I've created a 2d array with
[time,energy] and I believe numpy.wh
17 matches
Mail list logo