bundles / scipy 1.17.1 / scipy / stats / _stats_py / zmap
function
scipy.stats._stats_py:zmap
source: /scipy/stats/_stats_py.py :2858
Signature
def zmap ( scores , compare , axis = 0 , ddof = 0 , nan_policy = propagate ) Summary
Calculate the relative z-scores.
Extended Summary
Return an array of z-scores, i.e., scores that are standardized to zero mean and unit variance, where mean and variance are calculated from the comparison array.
Parameters
scores: array_likeThe input for which z-scores are calculated.
compare: array_likeThe input from which the mean and standard deviation of the normalization are taken; assumed to have the same dimension as
scores.axis: int or None, optionalAxis over which mean and variance of
compareare calculated. Default is 0. If None, compute over the whole arrayscores.ddof: int, optionalDegrees of freedom correction in the calculation of the standard deviation. Default is 0.
nan_policy: {'propagate', 'raise', 'omit'}, optionalDefines how to handle the occurrence of nans in
compare. 'propagate' returns nan, 'raise' raises an exception, 'omit' performs the calculations ignoring nan values. Default is 'propagate'. Note that when the value is 'omit', nans inscoresalso propagate to the output, but they do not affect the z-scores computed for the non-nan values.
Returns
zscore: array_likeZ-scores, in the same shape as
scores.
Notes
This function preserves ndarray subclasses, and works also with matrices and masked arrays (it uses asanyarray instead of asarray for parameters).
Array API Standard Support
zmap has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. 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
dev-arrayapifor more information.
Examples
from scipy.stats import zmap a = [0.5, 2.0, 2.5, 3] b = [0, 1, 2, 3, 4]✓
zmap(a, b)
✗Aliases
-
scipy.stats.zmap