[Numpy-discussion] indexing question
Todd Miller
jmiller at stsci.edu
Sat Mar 27 19:17:02 EST 2004
On Sat, 2004-03-27 at 19:27, Faheem Mitha wrote:
> On Sat, 27 Mar 2004, Todd Miller wrote:
>
> > Try foo[[0,2]]. Note that the array indexing syntax is a little picky:
> > foo[(0,2)] (tuple index) won't work, just foo[[0,2]] (list index) or
> > foo[array([0,2])] (array index).
>
> Thanks. I see this extracts the relevant rows. How about columns?
I think for columns you need to transpose the matrix or use take() with
the right axis=1.
> Also,
> where is this documented?
pp 35,36,37,49,50,51
> I spent quite a while poring over the numarray
> documentation. The section on index arrays looked relevant but I found it
> difficult to understand.
That's probably a corollary to the fact that index arrays, put, and take
*are* a little difficult to understand, even more so in numarray than in
Numeric.
Regards,
Todd
>
> Faheem.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
--
Todd Miller <jmiller at stsci.edu>
More information about the NumPy-Discussion
mailing list