To get what you request (2-norm of each row in your array), you can use the argument axisfor numpy.linalg.norm:
import numpy
x = numpy.array([[ -9.03525007, 7.45325017, 33.34074879],
[ -6.63700008, 5.13299996, 31.66075039],
[ -5.12724996, 8.25149989, 30.92599964],
[ -5.12724996, 8.25149989, 30.92599964]])
print numpy.linalg.norm(x, axis=1)
=>
array([ 35.33825423, 32.75363451, 32.41594355, 32.41594355])
source
share