# sciPy stats.zmap() function | Python

scipy.stats.zmap(scores, compare, axis=0, ddof=0) function computes the relative Z-score of the input data. The scores that are standardized to zero mean and unit variance, where mean and variance are calculated from the comparison array.

Its formula:

Parameters :
scores : [array_like]Input array or object for which Z-score is to calculate.
compare : [array_like]Input array or object for which the mean and standard deviation of the normalization are taken
axis : Axis along which the mean is to be computed. By default axis = 0.
ddof : Degree of freedom correction for Standard Deviation.

Results : Z-score of the input data.

Code #1: Working

 `# stats.zmap() method    ` `import` `numpy as np ` `from` `scipy ``import` `stats ` `   `  `arr1 ``=` `[[``20``, ``2``, ``7``, ``1``, ``34``], ` `        ``[``50``, ``12``, ``12``, ``34``, ``4``]] ` ` `  `arr2 ``=` `[[``50``, ``12``, ``12``, ``34``, ``4``],  ` `        ``[``12``, ``11``, ``10``, ``34``, ``21``]] ` ` `  `print` `(``"\narr1 : "``, arr1) ` `print` `(``"\narr2 : "``, arr2) ` ` `  `print` `(``"\nZ-score : \n"``, stats.zmap(arr1, arr2)) `

Output :

```arr1 :  [[20, 2, 7, 1, 34], [50, 12, 12, 34, 4]]

arr2 :  [[50, 12, 12, 34, 4], [12, 11, 10, 34, 21]]

Z-score :
[[ -0.57894737 -19.          -4.                 -inf   2.52941176]
[  1.           1.           1.                  nan  -1.        ]]
```

Code #2 : Z-score

 `# stats.zmap() method    ` `import` `numpy as np ` `from` `scipy ``import` `stats ` `   `  `arr1 ``=` `[[``20``, ``2``, ``7``, ``1``, ``34``], ` `        ``[``50``, ``12``, ``12``, ``34``, ``4``]] ` ` `  `arr2 ``=` `[[``50``, ``12``, ``12``, ``34``, ``4``],  ` `        ``[``12``, ``11``, ``10``, ``34``, ``21``]] ` ` `  `print` `(``"\nZ-score : \n"``, stats.zmap(arr1, arr2, axis ``=` `1``)) `

Output :

```sem ratio for arr1 :
[[-0.14087457 -1.19743386 -0.90394517 -1.2561316   0.68089376]
[ 3.5640998  -0.61601725 -0.61601725  1.80405051 -1.49604189]]
```

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.