Z score is also called standard score. This score helps to understand if a data value is greater or smaller than mean and how far away it is from the mean. More specifically, Z score tells how many standard deviations away a data point is from the mean.
Z score = (x - mean) / std. deviation
A normal distribution is shown below and it is estimated that
68% of the data points lie between +/- 1 standard deviation.
95% of the data points lie between +/- 2 standard deviation
99.7% of the data points lie between +/- 3 standard deviation
A standard value we assume for a z-score above which we will declare points as outliers is +3 or -3.
Z score and Outliers:
If the z score of a data point is more than 3, it indicates that the data point is quite different from the other data points. Such a data point can be an outlier.
Z-score > +3 or less than -3 means the data point is away from the mean by more than 3 standard deviations.
Z-score notes credits: https://www.geeksforgeeks.org/z-score-for-outlier-detection-python/