indexing question
wes weston
wweston at att.net
Fri Mar 26 11:32:32 EST 2004
Faheem Mitha wrote:
> Dear People,
>
> Suppose I create a numarray arry (say). A numeric array would be fine
> too; it probably does not matter.
>
>
>>>>import numarray
>>>>foo = numarray.reshape(numarray.arange(9),(3,3))
>
> array([[ 0, 1, 2, 3],
> [ 4, 5, 6, 7],
> [ 8, 9, 10, 11],
> [12, 13, 14, 15]])
>
> Is there some way to select the indexes corresponding only to (say)
> two rows or columns?
>
> ie suppose I just want the first and the fourth row or the first and
> third columns? Is there some clean way to do this which does not
> involve extract individual rows or columns?
>
> Ie. I want something like
>
>>>>foo[?,:]
>
> array([[ 0, 1, 2, 3],
> [12, 13, 14, 15]])
>
> etc.
>
> Suggestions appreciated. Thanks in advance.
>
> Faheem.
Faheem,
On the following like, I see something like what you
want.
http://matpy.sourceforge.net/MatPy/node3.html
wes
More information about the Python-list
mailing list