假设我有:
test = numpy.array([[1, 2], [3, 4], [5, 6]])
Run Code Online (Sandbox Code Playgroud)
test[i]让我第i个阵列(例如线[1, 2]).我怎样才能访问第i列?(例如[1, 3, 5]).这也是一项昂贵的操作吗?

目前我有:
def func(points): #Input is a matrix with n lines and 2 columns.
centroid = numpy.mean(points, axis=0)
sum = 0
for point in points:
x = point[0] - centroid[0]
y = point[1] - centorid[1]
sum += x**2 + y**2
return math.sqrt(sum)
Run Code Online (Sandbox Code Playgroud)