+2 votes
in Programming Languages by (73.8k points)
How to compute the z-score value for all elements of an array using a python library?

1 Answer

+1 vote
by (348k points)
selected by
 
Best answer

You can use zscore() function of stats module present in scipy. Check the following example:

>>> from scipy import stats
>>> import numpy as np
>>> a=np.array([10,11,34,21,45,65,32,12])
>>> stats.zscore(a)
array([-1.03539421, -0.98017318,  0.28991038, -0.42796294,  0.89734165,
        2.00176214,  0.17946833, -0.92495216])


...