Use numpy.spatial.distance.euclidean instead of lambda function.