What are z-scores?
Z-scores in statistics describe the relationship between a value and the mean of the data that is being observed. For example, if the z-score of a value is 1, that will mean the value is 1 standard deviation away from the mean of the data being observed. If the z-score is of a value is 2, that will mean the value is 2 standard deviations away from the mean of the data.
Z-scores can be positive or negative. A positive z-score means the value is more than the mean of the data being observed. And a negative z-score means the value is less than the mean of the data.
How to calculate z-scores?
The z-score of a value x is calculated using the following formula:
How to calculate z-scores using Python?
In Python, we can use the zscore() function from the scipy.stats module to calculate z-scores.
from scipy.stats import zscore D = [1, 3, 3, 5, 7, 8, 10, 12, 15, 16] z = zscore(D) print(z)
Here, D is the data being observed. And the zscore(D) function calculates the z-scores of all the values of D.
The output of the above program will be: …






0 Comments