![](https://secure.gravatar.com/avatar/b3308afd77cbb561a4c676aa091e55fc.jpg?s=120&d=mm&r=g)
Dear People, Suppose I create a numarray arry (say). A numeric array would be fine too; it probably does not matter.
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 extracting individual rows or columns? Ie. I want something like
etc. Suggestions appreciated. Please cc me; I'm not subscribed. Thanks in advance. Faheem.
![](https://secure.gravatar.com/avatar/b3308afd77cbb561a4c676aa091e55fc.jpg?s=120&d=mm&r=g)
On Sat, 27 Mar 2004, Todd Miller wrote:
Thanks. I see this extracts the relevant rows. How about columns? Also, where is this documented? I spent quite a while poring over the numarray documentation. The section on index arrays looked relevant but I found it difficult to understand. Faheem.
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sat, 2004-03-27 at 19:27, Faheem Mitha wrote:
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
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
-- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sat, 2004-03-27 at 23:47, Faheem Mitha wrote:
Yes, you're right, that's an error.
This too looks like an error. Both usages should raise an exception... and hopefully a prettier one in the future. Thanks for the questions and feedback. Regards, Todd -- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/b3308afd77cbb561a4c676aa091e55fc.jpg?s=120&d=mm&r=g)
On Sat, 27 Mar 2004, Todd Miller wrote:
Thanks. I see this extracts the relevant rows. How about columns? Also, where is this documented? I spent quite a while poring over the numarray documentation. The section on index arrays looked relevant but I found it difficult to understand. Faheem.
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sat, 2004-03-27 at 19:27, Faheem Mitha wrote:
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
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
-- Todd Miller <jmiller@stsci.edu>
![](https://secure.gravatar.com/avatar/faf9400121dca9940496a7473b1d8179.jpg?s=120&d=mm&r=g)
On Sat, 2004-03-27 at 23:47, Faheem Mitha wrote:
Yes, you're right, that's an error.
This too looks like an error. Both usages should raise an exception... and hopefully a prettier one in the future. Thanks for the questions and feedback. Regards, Todd -- Todd Miller <jmiller@stsci.edu>
participants (2)
-
Faheem Mitha
-
Todd Miller