scipy.spatial.
minkowski_distance#
- scipy.spatial.minkowski_distance(x, y, p=2.0)[source]#
Compute the L**p distance between two arrays.
The last dimensions of x and y must be the same length. Any other dimensions must be compatible for broadcasting.
Deprecated since version 1.18.0: This function is deprecated in favor of
scipy.spatial.distance.minkowskiand will be removed in SciPy 1.20.0.- Parameters:
- x(…, K) array_like
Input array.
- y(…, K) array_like
Input array.
- pfloat, 1 <= p <= infinity
Which Minkowski p-norm to use.
- Returns:
- distndarray
Distance between the input arrays.
Notes
Array API Standard Support
minkowski_distanceis not in-scope for support of Python Array API Standard compatible backends other than NumPy.See Support for the array API standard for more information.
Examples
>>> from scipy.spatial import minkowski_distance >>> minkowski_distance([[0, 0], [0, 0]], [[1, 1], [0, 1]]) array([ 1.41421356, 1. ])