Re: [Numpy-discussion] ndarray with double comparison

2011-10-15 Thread Chao YUE
Thanks. quite useful!! Chao 2011/10/15 Neil > Marc Shivers gmail.com> writes: > > > > > you could use bitwise comparison with paretheses: In [8]: > (a>4)&(a<8)Out[8]: > array([False, False, False, False, False, True, True, True, False, > False, False], dtype=bool) > > > > For cases like th

Re: [Numpy-discussion] ndarray with double comparison

2011-10-15 Thread Neil
Marc Shivers gmail.com> writes: > > you could use bitwise comparison with paretheses:  In [8]: (a>4)&(a<8)Out[8]: array([False, False, False, False, False,  True,  True,  True, False,   False, False], dtype=bool) > For cases like this I find it very useful to define a function between()

Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Marc Shivers
you could use bitwise comparison with paretheses: In [8]: (a>4)&(a<8) Out[8]: array([False, False, False, False, False, True, True, True, False, False, False], dtype=bool) On Thu, Oct 13, 2011 at 12:13 PM, Chao YUE wrote: > Dear all, > > sorry for this stupid question but I cannot fin

Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Chao YUE
Thanks. I starts to use python do some real data processing and has bunch of questions. Chao 2011/10/13 Benjamin Root > On Thu, Oct 13, 2011 at 11:13 AM, Chao YUE wrote: > >> Dear all, >> >> sorry for this stupid question but I cannot find it in numpy tutorial or >> google. >> suppose I have a

Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Benjamin Root
On Thu, Oct 13, 2011 at 11:13 AM, Chao YUE wrote: > Dear all, > > sorry for this stupid question but I cannot find it in numpy tutorial or > google. > suppose I have a=np.arange(11). > > In [32]: a < 8 > Out[32]: > array([ True, True, True, True, True, True, True, True, False, >Fal

Re: [Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Gökhan Sever
On Thu, Oct 13, 2011 at 10:13 AM, Chao YUE wrote: > Dear all, > > sorry for this stupid question but I cannot find it in numpy tutorial or > google. > suppose I have a=np.arange(11). > > In [32]: a < 8 > Out[32]: > array([ True, True, True, True, True, True, True, True, False, >Fal

[Numpy-discussion] ndarray with double comparison

2011-10-13 Thread Chao YUE
Dear all, sorry for this stupid question but I cannot find it in numpy tutorial or google. suppose I have a=np.arange(11). In [32]: a < 8 Out[32]: array([ True, True, True, True, True, True, True, True, False, False, False], dtype=bool) In [34]: a > 4 Out[34]: array([False, False,