Skip to content Skip to sidebar Skip to footer

Error When Replacing Row In Numpy Array

I am hitting a problem trying to replace a row in a numpy 2-d array with a new row. I am trying to write a function to take an n by m matrix (n samples of m-length vectors) and ret

Solution 1:

It looks to me like it's taking the rounded division instead of the normal one. What happens if you try to

z = z.astype('float64')
z[0] /= la.norm(z[0])

Also, what version numpy and python are you using? Is it by any chance python 2.X ?

Post a Comment for "Error When Replacing Row In Numpy Array"