[Numpy-discussion] Changing a matrix element into a scalar

Alan G Isaac alan.isaac at gmail.com
Tue Aug 3 12:56:13 EDT 2010


On 8/3/2010 12:23 PM, Wayne Watson wrote:
> How do I access 1.2 in such a way as to end up with a float? I keep
> getting a matrix.
> from numpy import matrix
> m = matrix([[1.2],[2.3]])

Matrices have the odd (and imo undesirable) property that
	m[0,0] != m[0][0]
You want the former.

For a discussion that eventually aborted, see
	http://www.scipy.org/MatrixIndexing

Alan Isaac



More information about the NumPy-Discussion mailing list