{"id":2368,"date":"2026-11-09T06:20:13","date_gmt":"2026-11-09T06:20:13","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=2368"},"modified":"2026-11-10T16:18:48","modified_gmt":"2026-11-10T16:18:48","slug":"z-score-tutorial","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/","title":{"rendered":"Z- Score"},"content":{"rendered":"<h1><strong><b>Z Score: Definition, Formula and Worked Examples<\/b><\/strong><\/h1>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Sarah scores 70 out of 100. Is that good? It depends on the class. If the average was 60, she did well. If the average was 85, she did badly. A raw score means little until you compare it with the group. A z score does exactly that: it tells you how far a value sits from the average, counted in standard deviations.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">It is one of the simplest and most used tools in data science. Analysts use it to compare values measured on different scales, to find outliers, to scale features before a model, and to turn a normal curve question into a table lookup.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">This tutorial explains what a z score is, how to read positive and negative values, the formula, a fully worked example with the answer, how to find percentiles and work backwards, how to spot outliers, and how to calculate z scores in Python.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Z Score in Data Science: Definition<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">A z score, also called a standard score, shows how many standard deviations a data point lies from the mean of its group.<\/p>\n<h3 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 21px; line-height: 1.35; font-weight: bold; color: #0f2a4a; margin: 28px 0 10px;\">How to Read a Z Score?<\/h3>\n<ul style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 24px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">z = 0: the value equals the mean.<\/li>\n<li style=\"margin: 0 0 8px;\">z = 1: the value is one standard deviation above the mean.<\/li>\n<li style=\"margin: 0 0 8px;\">z = 2: two standard deviations above the mean.<\/li>\n<li style=\"margin: 0 0 8px;\">z = 3: three standard deviations above the mean. This is rare.<\/li>\n<li style=\"margin: 0 0 8px;\">A positive z: the value is above the mean.<\/li>\n<li style=\"margin: 0 0 8px;\">A negative z: the value is below the mean. For example, z = minus 1.5 is one and a half standard deviations below.<\/li>\n<\/ul>\n<div style=\"margin: 16px 0 24px;\"><img decoding=\"async\" style=\"display: block; max-width: 100%; height: auto; border: 1px solid #d9e0ea; border-radius: 8px;\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png\" alt=\"z score, how to read positive and negative values on the normal curve\" \/><\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The size of z matters, not just its sign. A z of 2.4 and a z of minus 2.4 are equally far from the mean, on opposite sides.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The live page says that a z score comes under probability. It is calculated as part of descriptive statistics, where it is a way of standardizing data. It enters probability when you read the area under the normal curve for a z value.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Z Score Formula<\/h2>\n<div style=\"margin: 16px 0 24px;\"><img decoding=\"async\" style=\"display: block; max-width: 100%; height: auto; border: 1px solid #d9e0ea; border-radius: 8px;\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore1.jpg\" alt=\"z score formula\" \/><\/div>\n<div style=\"margin: 0 0 16px; padding: 12px 16px; background: #f5f8fc; border-left: 4px solid #0f2a4a; border-radius: 4px; overflow-x: auto; font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.6; font-weight: bold; color: #0f2a4a;\">z = (x minus mean) divided by standard deviation<\/div>\n<ul style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 24px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">x = the value you are checking.<\/li>\n<li style=\"margin: 0 0 8px;\">mean = the average of the group.<\/li>\n<li style=\"margin: 0 0 8px;\">standard deviation = the spread of the group.<\/li>\n<\/ul>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">In symbols, for a population: z = (x minus mu) divided by sigma. For a sample: z = (x minus x bar) divided by s.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Steps to Calculate a Z Score<\/h2>\n<ol style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 28px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">Find the mean of the data.<\/li>\n<li style=\"margin: 0 0 8px;\">Find the standard deviation.<\/li>\n<li style=\"margin: 0 0 8px;\">Subtract the mean from the value.<\/li>\n<li style=\"margin: 0 0 8px;\">Divide by the standard deviation.<\/li>\n<li style=\"margin: 0 0 8px;\">Read the result: its sign gives the direction and its size gives the distance.<\/li>\n<\/ol>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Z Score Example<\/h2>\n<div style=\"margin: 16px 0 24px;\"><img decoding=\"async\" style=\"display: block; max-width: 100%; height: auto; border: 1px solid #d9e0ea; border-radius: 8px;\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore2.jpg\" alt=\"z score example\" \/><\/div>\n<h3 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 21px; line-height: 1.35; font-weight: bold; color: #0f2a4a; margin: 28px 0 10px;\">Example 1: Sarah&#8217;s Score<\/h3>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The live page: Sarah scored 70 out of 100. The class mean was 60 and the standard deviation was 15. How many students scored higher or lower? The page does not answer. Here is the full solution.<\/p>\n<ul style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 24px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">Z = (70 minus 60) divided by 15 = 10 divided by 15 = 0.667.<\/li>\n<li style=\"margin: 0 0 8px;\">Meaning: Sarah is about two thirds of a standard deviation above the class mean.<\/li>\n<li style=\"margin: 0 0 8px;\">Area to the left of 0.667 = 0.7475 (from a z table or software).<\/li>\n<\/ul>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">If the marks follow a normal distribution, about 74.75 percent of the class scored lower than Sarah, and about 25.25 percent scored higher. The normal assumption matters. Without it, the z score still tells you the distance from the mean, but the percentage may be different.<\/p>\n<h3 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 21px; line-height: 1.35; font-weight: bold; color: #0f2a4a; margin: 28px 0 10px;\">Example 2: Working Backwards<\/h3>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">You can turn a z score back into a raw score: x = mean plus z times standard deviation.<\/p>\n<ul style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 24px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">A z of 1.5 in Sarah&#8217;s class is a score of 60 + 1.5 times 15 = 82.5.<\/li>\n<li style=\"margin: 0 0 8px;\">The 90th percentile has a z of 1.282, so the score is 60 + 1.282 times 15 = 79.22. A student needs about 79 marks to beat 90 percent of the class.<\/li>\n<\/ul>\n<h3 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 21px; line-height: 1.35; font-weight: bold; color: #0f2a4a; margin: 28px 0 10px;\">Example 3: Comparing Two Exams<\/h3>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Exam A: the mean is 70, the standard deviation is 8, and a student scores 82. Exam B: the mean is 500, the standard deviation is 100, and a student scores 640.<\/p>\n<div style=\"border: 1px solid #d9e0ea; border-radius: 8px; overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch;\">\n<table style=\"width: 100%; min-width: 640px; border-collapse: collapse; font-family: Arial,Helvetica,sans-serif; font-size: 16px; line-height: 1.6; color: #1f2937;\">\n<caption style=\"caption-side: top; text-align: left; padding: 14px 16px; font-weight: bold; font-size: 17px; color: #0f2a4a;\">Z scores for the two exams<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 200px;\" scope=\"col\">Point<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Exam A<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Exam B<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Score<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">82<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">640<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Z score<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">1.5<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">1.4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The 82 is slightly stronger, at 1.5 standard deviations above its mean against 1.4. This is the main use of z scores: putting different scales on one ruler.<\/p>\n<h3 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 21px; line-height: 1.35; font-weight: bold; color: #0f2a4a; margin: 28px 0 10px;\">Example 4: A Small Class<\/h3>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Eight students scored 55, 60, 65, 70, 48, 72, 80 and 58. The mean is 63.5. The population standard deviation is 9.644, and the sample standard deviation is 10.309. Their z scores, using the population standard deviation, are:<\/p>\n<div style=\"border: 1px solid #d9e0ea; border-radius: 8px; overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch;\">\n<table style=\"width: 100%; min-width: 900px; border-collapse: collapse; font-family: Arial,Helvetica,sans-serif; font-size: 16px; line-height: 1.6; color: #1f2937;\">\n<caption style=\"caption-side: top; text-align: left; padding: 14px 16px; font-weight: bold; font-size: 17px; color: #0f2a4a;\">Marks and z scores for eight students<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 160px;\" scope=\"col\">Mark<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">55<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">60<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">65<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">70<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">48<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">72<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">80<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">58<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Z score<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Minus 0.88<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Minus 0.36<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">0.16<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">0.67<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Minus 1.61<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">0.88<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">1.71<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Minus 0.57<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Two things to notice. The z scores are negative for marks below the mean, and the 80 stands out most, at 1.71. And after standardizing, the z scores have a mean of 0 and a standard deviation of 1. Check the code below.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Population or sample? If your data are the whole group, divide by the population standard deviation. If they are a sample, the sample version, with n minus 1, is usually used. The z scores change a little. Python&#8217;s stats.zscore uses the population version unless you set ddof to 1.<\/p>\n<div style=\"position: relative; width: 100%; padding-bottom: 56.25%; height: 0; overflow: hidden; margin: 20px 0; border-radius: 8px; background: #0f2a4a;\"><iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;\" title=\"Z score video\" src=\"https:\/\/www.youtube.com\/embed\/xA5TAalZt40\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Using Z Scores to Find Outliers<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">A common rule marks a value as an outlier if its z score is above 3 or below minus 3. For normal data, only about 0.27 percent of values lie that far out. In my test, I made 49 normal values with a mean of 60 and a standard deviation of 15, and added one extreme value, 140. Its z score was 4.18, and it was the only value with an absolute z score above 3.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">A warning: an outlier raises the standard deviation, which makes its own z score smaller. In small data sets, extreme values can hide. Also, for skewed data, the rule of three can flag too many or too few points.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Z Score Table: Common Values<\/h2>\n<div style=\"border: 1px solid #d9e0ea; border-radius: 8px; overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch;\">\n<table style=\"width: 100%; min-width: 760px; border-collapse: collapse; font-family: Arial,Helvetica,sans-serif; font-size: 16px; line-height: 1.6; color: #1f2937;\">\n<caption style=\"caption-side: top; text-align: left; padding: 14px 16px; font-weight: bold; font-size: 17px; color: #0f2a4a;\">Area to the left of common z scores<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 200px;\" scope=\"col\">Z score<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Area to the left<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Meaning<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Minus 2<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.0228<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Lowest 2.3 percent<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Minus 1<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.1587<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Lowest 15.9 percent<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">0<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.5000<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">The median<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">1<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.8413<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Top 15.9 percent<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">1.645<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.9500<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">95th percentile<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">1.96<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.9750<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Used for 95 percent intervals<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">2.576<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">0.9950<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Used for 99 percent intervals<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Calculate Z Scores in Python<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">I ran the code below, and the output is real.<\/p>\n<div style=\"margin: 20px 0; border: 1px solid #d9e0ea; border-radius: 8px; overflow: hidden;\">\n<div style=\"background: #0f2a4a; color: #ffffff; font-family: Arial,Helvetica,sans-serif; font-size: 14px; font-weight: bold; padding: 8px 16px;\">python<\/div>\n<pre style=\"margin: 0; padding: 16px; color: #1f2937; font-family: 'Courier New',Courier,monospace; font-size: 14px; line-height: 1.7; overflow-x: auto; white-space: pre; background: #f5f8fc;\">import numpy as np\r\nfrom scipy import stats\r\n\r\n# Sarah: 70 out of 100, class mean 60, sd 15\r\nz = (70 - 60) \/ 15\r\nprint(\"Sarah z:\", round(z, 3))\r\nprint(\"Share who scored lower (normal data):\", round(float(stats.norm.cdf(z)), 4))\r\nprint(\"Share who scored higher:\", round(float(stats.norm.sf(z)), 4))\r\n\r\n# Working backwards: score for z = 1.5 and for the 90th percentile\r\nprint(\"Score at z = 1.5:\", 60 + 1.5 * 15)\r\nprint(\"Score at 90th percentile:\", round(60 + float(stats.norm.ppf(0.90)) * 15, 2))\r\n\r\n# A small class: marks of 8 students\r\nmarks = np.array([55, 60, 65, 70, 48, 72, 80, 58])\r\nprint(\"Mean:\", marks.mean(), \" Population sd:\", round(float(marks.std()), 3), \" Sample sd:\", round(float(marks.std(ddof=1)), 3))\r\nzs = stats.zscore(marks)\r\nprint(\"Z scores:\", [round(float(v), 2) for v in zs])\r\nprint(\"Mean of z scores:\", round(float(zs.mean()), 4), \" sd of z scores:\", round(float(zs.std()), 4))\r\n\r\n# Spotting outliers: one extreme value among 50 normal values\r\nrng = np.random.default_rng(4)\r\nx = np.append(rng.normal(60, 15, 49), 140)\r\nzz = stats.zscore(x)\r\nprint(\"Largest z:\", round(float(zz.max()), 2), \" Values with |z| above 3:\", int((np.abs(zz) &gt; 3).sum()))\r\n\r\n# Comparing two exams\r\nprint(\"Exam A z:\", round((82 - 70) \/ 8, 2), \" Exam B z:\", round((640 - 500) \/ 100, 2))<\/pre>\n<div style=\"background: #1f2937; color: #ffffff; font-family: Arial,Helvetica,sans-serif; font-size: 14px; font-weight: bold; padding: 8px 16px;\">output<\/div>\n<pre style=\"margin: 0; padding: 16px; color: #1f2937; font-family: 'Courier New',Courier,monospace; font-size: 14px; line-height: 1.7; overflow-x: auto; white-space: pre; background: #ffffff;\">Sarah z: 0.667\r\nShare who scored lower (normal data): 0.7475\r\nShare who scored higher: 0.2525\r\nScore at z = 1.5: 82.5\r\nScore at 90th percentile: 79.22\r\nMean: 63.5  Population sd: 9.644  Sample sd: 10.309\r\nZ scores: [-0.88, -0.36, 0.16, 0.67, -1.61, 0.88, 1.71, -0.57]\r\nMean of z scores: 0.0  sd of z scores: 1.0\r\nLargest z: 4.18  Values with |z| above 3: 1\r\nExam A z: 1.5  Exam B z: 1.4<\/pre>\n<\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Common Mistakes to Avoid<\/h2>\n<div style=\"border: 1px solid #d9e0ea; border-radius: 8px; overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch;\">\n<table style=\"width: 100%; min-width: 760px; border-collapse: collapse; font-family: Arial,Helvetica,sans-serif; font-size: 16px; line-height: 1.6; color: #1f2937;\">\n<caption style=\"caption-side: top; text-align: left; padding: 14px 16px; font-weight: bold; font-size: 17px; color: #0f2a4a;\">Common mistakes and fixes<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 420px;\" scope=\"col\">Mistake<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Dividing by the variance<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Divide by the standard deviation<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Forgetting the sign<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">A negative z means below the mean<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Subtracting in the wrong order<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Value minus mean, not mean minus value<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Using a z table for non normal data without a check<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Percentages need a roughly normal shape<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Mixing population and sample standard deviation<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">State which one you used<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Comparing raw scores from different exams<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Compare z scores<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Calling every large z an error<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">A large z flags a value to check, not a mistake<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Writing the formula only as an image<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Put it in text as well<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Practice Questions<\/h2>\n<ol style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 28px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">Mean 50, standard deviation 10. Find the z score of 68.<\/li>\n<li style=\"margin: 0 0 8px;\">Mean 80, standard deviation 12. A z score is minus 1.5. What is the value?<\/li>\n<li style=\"margin: 0 0 8px;\">A student has z = 2 in Exam A and z = 1.2 in Exam B. Which result is stronger?<\/li>\n<li style=\"margin: 0 0 8px;\">A value has z = minus 3.4. Is it likely an outlier?<\/li>\n<\/ol>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Answers: 1) (68 minus 50) divided by 10 = 1.8. 2) 80 + (minus 1.5) times 12 = 62. 3) Exam A, since 2 is higher than 1.2. 4) Yes, it is beyond minus 3, so check it. These are my own answers, so please recheck them before publishing.<\/p>\n<p>A z score takes a raw number and gives it context: how far from the average, in which direction and in units that work everywhere. Learn the formula, remember that the sign gives the direction, and you can compare almost anything.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Z Score: Definition, Formula and Worked Examples Sarah scores 70 out of 100. Is that good? It depends on the class. If the average was 60, she did well. If the average was 85, she did badly. A raw score means little until you compare it with the group. A z score does exactly that: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,1704],"tags":[171,170,172,169],"class_list":["post-2368","post","type-post","status-publish","format-standard","hentry","category-data-science","category-data-science-modules","tag-z-score-analysis-example","tag-z-score-formula","tag-z-score-in-data-science","tag-z-score-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Z Score Tutorial: Definition, Formula and Examples | PrwaTech<\/title>\n<meta name=\"description\" content=\"Learn the z score: definition, formula, how to read positive and negative values, a worked example, percentiles, outliers and Python code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Z Score Tutorial: Definition, Formula and Examples | PrwaTech\" \/>\n<meta property=\"og:description\" content=\"Learn the z score: definition, formula, how to read positive and negative values, a worked example, percentiles, outliers and Python code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-09T06:20:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-10T16:18:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/\",\"url\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/\",\"name\":\"Z Score Tutorial: Definition, Formula and Examples | PrwaTech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png\",\"datePublished\":\"2026-11-09T06:20:13+00:00\",\"dateModified\":\"2026-11-10T16:18:48+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Learn the z score: definition, formula, how to read positive and negative values, a worked example, percentiles, outliers and Python code.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png\",\"width\":449,\"height\":257},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Z- Score\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Z Score Tutorial: Definition, Formula and Examples | PrwaTech","description":"Learn the z score: definition, formula, how to read positive and negative values, a worked example, percentiles, outliers and Python code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Z Score Tutorial: Definition, Formula and Examples | PrwaTech","og_description":"Learn the z score: definition, formula, how to read positive and negative values, a worked example, percentiles, outliers and Python code.","og_url":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2026-11-09T06:20:13+00:00","article_modified_time":"2026-11-10T16:18:48+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/","url":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/","name":"Z Score Tutorial: Definition, Formula and Examples | PrwaTech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png","datePublished":"2026-11-09T06:20:13+00:00","dateModified":"2026-11-10T16:18:48+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Learn the z score: definition, formula, how to read positive and negative values, a worked example, percentiles, outliers and Python code.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/ZScore.png","width":449,"height":257},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/z-score-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Z- Score"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=2368"}],"version-history":[{"count":12,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2368\/revisions"}],"predecessor-version":[{"id":12159,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2368\/revisions\/12159"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=2368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=2368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=2368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}