[Numpy-discussion] Indexing into a matrix

Keith Goodman kwgoodman@gmail....
Thu Dec 20 11:10:52 CST 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