From: Stefan v. d. W. <st...@su...> - 2006-11-11 22:13:03
|
On Sat, Nov 11, 2006 at 01:59:40PM -0800, Keith Goodman wrote: > Would it make sense to upcast instead of downcast? >=20 > This upcasts: >=20 > >> x =3D M.matrix([[1, M.nan, 3]]) > >> x > matrix([[ 1. , nan, 3. ]]) >=20 > But this doesn't: >=20 > >> x =3D M.matrix([[1, 2, 3]]) > >> x[0,1] =3D M.nan > >> x > matrix([[1, 0, 3]]) This behaviour is consistent with x =3D N.array([[1,2.0,3]]) vs x =3D N.array([1,2,3]) x[0,1] =3D 2. > (BTW, how do you represent missing integers if you can't use NaN?) I think masked arrays should work on integer arrays (alternatively, if you have enough memory, cast your array to float). Regards St=E9fan |