[Numpy-discussion] Selecting columns of a matrix (original) (raw)
Travis Oliphant oliphant.travis at ieee.org
Wed Jun 21 11:52:24 EDT 2006
- Previous message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Next message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bill Baxter wrote:
On 6/21/06, Simon Burton <simon at arrowtheory.com_ _<mailto:simon at arrowtheory.com>> wrote:
On Wed, 21 Jun 2006 13:48:48 +0900 "Bill Baxter" <wbaxter at gmail.com <mailto:wbaxter at gmail.com>> wrote: > > >>> a[:,num.where(v>0.5)[0]] > array([[1, 2, 4], > [6, 7, 9]]) > > I'll put that up on the Matlab->Numpy page. oh, yuck. What about this: >>> a[:,num.nonzero(v>0.5)] array([[0, 1, 3], [5, 6, 8]]) >>>
The nonzero() function seems like kind of an anomaly in and of itself. It doesn't behave like other index-returning numpy functions, or even like the method version, v.nonzero(), which returns the typical tuple of array. So my feeling is ... ew to numpy.nonzero.
How about we add the ability so that
a[:, ] gets translated to
a[:, nonzero()] ?
-Travis
- Previous message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Next message (by thread): [Numpy-discussion] Selecting columns of a matrix
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]