[Numpy-discussion] matrix indexing question
Alan G Isaac
aisaac at american.edu
Sun Mar 25 13:07:25 EDT 2007
One thing keeps bugging me when I use numpy.matrix.
All this is fine::
>>> x=N.mat('1 1;1 0')
>>> x
matrix([[1, 1],
[1, 0]])
>>> x[1,:]
matrix([[1, 0]])
But it seems to me that I should be able
to extract a matrix row as an array.
So this ::
>>> x[1]
matrix([[1, 0]])
feels wrong. (Similarly when iterating across rows.)
Of course I realize that I can just ::
>>> x.A[1]
array([1, 0])
but since the above keeps feeling wrong I felt I should
raise this as a possible design issue, better discussed
early than latter.
Cheers,
Alan Isaac
More information about the NumPy-Discussion
mailing list