scipy.spatial.distance.
num_obs_y#
- scipy.spatial.distance.num_obs_y(Y)[source]#
Return the number of original observations that correspond to a condensed distance matrix.
- Parameters:
- Yarray_like
Condensed distance matrix.
- Returns:
- nint
The number of observations in the condensed distance matrix Y.
Notes
Array API Standard Support
num_obs_yhas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
✅
JAX
✅
✅
Dask
✅
n/a
See Support for the array API standard for more information.
Examples
Find the number of original observations corresponding to a condensed distance matrix Y.
>>> from scipy.spatial.distance import num_obs_y >>> Y = [1, 2, 3.5, 7, 10, 4] >>> num_obs_y(Y) 4