[Numpy-discussion] Indexing into a matrix

Keith Goodman kwgoodman at gmail.com
Thu Dec 20 12:10:52 EST 2007


>> x = M.rand(3,1)  <-------- 3x1
>> x[M.isfinite(x)]
matrix([[ 0.36541551,  0.6305087 ,  0.66054899]])   <---------- Should
this be 3x1?

My workaround is awkward:

>> x[M.where(M.isfinite(x).A)[0]]
matrix([[ 0.36541551],
        [ 0.6305087 ],
        [ 0.66054899]])



More information about the NumPy-Discussion mailing list