[Numpy-discussion] nonzero() behaviour has changed
Travis Oliphant
oliphant.travis at ieee.org
Wed May 17 15:20:01 EDT 2006
Simon Burton wrote:
> On Tue, 16 May 2006 15:15:23 -0400
> Alan G Isaac <aisaac at american.edu> wrote:
>
>
>> 2. How are people using this? I trust that the numarray
>> behavior was well considered, but I would have expected
>> coordinates to be grouped rather than spread across
>> the arrays in the tuple.
>>
>
>
The split-tuple is for fancy-indexing. That's how you index a
multidimensional array using an array of integers. The output of
a.nonzero() is setup to do that so that
a[a.nonzero()]
works.
> Yes, this strikes me as bizarre.
> How about we make a new function, eg. argwhere, that
> returns an array of indices ?
>
> argwhere( array( [[0,1],[0,1]] ) ) -> [[0,1],[1,1]]
>
>
I could see the value of this kind of function too.
-Travis
More information about the NumPy-Discussion
mailing list