From: Bill B. <wb...@gm...> - 2006-05-18 11:44:56
|
On 5/18/06, Ed Schofield <sch...@ft...> wrote: > > Bill Baxter wrote: > > Sure would be nice if all you had to type was a.nonzero().T, though... > ;-P > > No, this wouldn't be possible -- the output of the nonzero method is a > tuple, not an array. Perhaps this is why it's not _that_ obvious ;) Oh, I see. I did miss that bit. I think I may have even done something recently myself like vstack(where(a > val)).transpose() not realizing that plain old transpose() would work in place of vstack(xxx).transpose(). If you feel like copy-pasting your doc addition for nonzero() over to where() also, that would be nice. What other functions work like that? ... <me rummages around a little> ..= . actually it looks like most other functions similar to nonzero() return a boolean array, then you use where() if you need an index list. isnan(), iscomplex(), isinf(), isreal(), isneginf(), etc and of course all the boolean operators like a>0. So nonzero() is kind of an oddball. Is it actually any different from where(a!=3D0)? --bill |