Dear People,
Suppose I create a numarray arry (say). A numeric array would be fine
too; it probably does not matter.
[color=blue][color=green][color=darkred]
>>>import numarray
>>>foo = numarray.reshap e(numarray.aran ge(9),(3,3))[/color][/color][/color]
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[color=blue][color=green][color=darkred]
>>> foo[?,:][/color][/color][/color]
array([[ 0, 1, 2, 3],
[12, 13, 14, 15]])
etc.
Suggestions appreciated. Thanks in advance.
Faheem.
Suppose I create a numarray arry (say). A numeric array would be fine
too; it probably does not matter.
[color=blue][color=green][color=darkred]
>>>import numarray
>>>foo = numarray.reshap e(numarray.aran ge(9),(3,3))[/color][/color][/color]
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[color=blue][color=green][color=darkred]
>>> foo[?,:][/color][/color][/color]
array([[ 0, 1, 2, 3],
[12, 13, 14, 15]])
etc.
Suggestions appreciated. Thanks in advance.
Faheem.
Comment