Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Robert Kern
Christopher Barker wrote: > Bill Baxter wrote: >>> In [35]: x = [ 0, 0, 0, 99, 0, 1, 5] >>> In [37]: i=nonzero(x) >>> In [38]: i >>> Out[38]: (array([3, 5, 6]),) > >> Just do i[0]. It's an array, not a string. Try typing "type(i[0])" >> and see what it tells you. > > Which still begs the questi

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Christopher Barker
Bill Baxter wrote: >> In [35]: x = [ 0, 0, 0, 99, 0, 1, 5] >> In [37]: i=nonzero(x) >> In [38]: i >> Out[38]: (array([3, 5, 6]),) > Just do i[0]. It's an array, not a string. Try typing "type(i[0])" > and see what it tells you. Which still begs the question: why does nonzero() return a tuple wi

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Bill Baxter
On 4/21/07, Dennis Cooke <[EMAIL PROTECTED]> wrote: > I'm an ex-Matlab user trying to come up to speed with python and numpy. Howdy. First, I hope you've checked out the page: http://www.scipy.org/NumPy_for_Matlab_Users > I'm > confused on how to use the Numpy functions nonzero() and where().

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Timothy Hochberg
On 4/20/07, Dennis Cooke <[EMAIL PROTECTED]> wrote: I'm an ex-Matlab user trying to come up to speed with python and numpy. I'm confused on how to use the Numpy functions nonzero() and where(). In matlab, the equivalent function (find(a>0) ) would return an array, whereas in numpy, where() or n

[Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Dennis Cooke
I'm an ex-Matlab user trying to come up to speed with python and numpy. I'm confused on how to use the Numpy functions nonzero() and where(). In matlab, the equivalent function (find(a>0) ) would return an array, whereas in numpy, where() or nonzero() will return a single element tuple. For exa