{"id":2240,"date":"2026-11-01T10:08:40","date_gmt":"2026-11-01T10:08:40","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=2240"},"modified":"2026-11-02T14:39:03","modified_gmt":"2026-11-02T14:39:03","slug":"standard-deviation-tutorial","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/","title":{"rendered":"Standard Deviation Tutorial"},"content":{"rendered":"<h1><strong><b>Standard Deviation: 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;\">Two machines fill 50 gram packets. Over a day, both average exactly 50 grams. One makes packets that all weigh between 49.8 and 50.2. The other makes packets from 46.5 to 53.5. Same average, very different machines. The average cannot tell them apart, and standard deviation can.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Standard deviation is the number that says how far values typically sit from their mean. It is one of the most used ideas in data science, in quality control, in finance, and in every statistics course. You will see it in z scores, in confidence intervals, in feature scaling and in outlier detection.<\/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 it means, how to calculate it by hand on two examples, the difference between the population and the sample version, the 68 95 99.7 rule, and how to get it in Python. If you are new, read our measures of central tendency and sample variance tutorials first.<\/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;\">Standard Deviation Definition in Statistics<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Standard deviation measures how spread out the values of a dataset are around their mean. A low value means the data sits close to the mean. A high value means it is scattered. The higher the dispersion, the greater the standard deviation.<\/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 the square root of the variance. Variance is in squared units, such as square millimetres, which is hard to picture. Taking the square root brings you back to the original unit, so a standard deviation of 147 mm can be read as 147 mm.<\/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;\">Example of Standard Deviation: Heights of Dogs<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">You measure the heights, at the shoulder, of five dogs. They are 600, 470, 170, 430 and 300 millimetres.<\/p>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/standDev2.gif\" alt=\"Standard deviation example\" width=\"850\" height=\"283\" \/><\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Let us plot these on a chart, and then find the mean.<\/p>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/standDev3.gif\" alt=\"Standard deviation example, plot\" width=\"850\" height=\"284\" \/><\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The mean is (600 plus 470 plus 170 plus 430 plus 300) divided by 5 = 1970 divided by 5 = 394 mm. Now find how far each dog is from the mean.<\/p>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/standDev5.gif\" alt=\"Mean of standard deviation example\" width=\"850\" height=\"227\" \/><\/div>\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;\">Dog heights: difference from the mean, squared<\/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\">Height<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Minus the mean (394)<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Squared<\/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\">600<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">206<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">42,436<\/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\">470<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">76<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">5,776<\/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\">170<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 224<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">50,176<\/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\">430<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">36<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">1,296<\/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\">300<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 94<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">8,836<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Total<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">0<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">108,520<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/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;\">Variance = 108,520 divided by 5 = 21,704 (square millimetres)<\/li>\n<li style=\"margin: 0 0 8px;\">Standard deviation = the square root of 21,704 = 147.32, so about 147 mm<\/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;\">Now you have a yardstick. The range of one standard deviation around the mean runs from 394 minus 147 to 394 plus 147, which is about 247 mm to 541 mm. Dogs of 470, 430 and 300 mm fall inside the range, so they count as normal. The dogs of 600 mm and 170 mm fall outside it, so they are extra tall and extra short.<\/p>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/standDev4-1.gif\" alt=\"Standard deviation example of dogs\" width=\"850\" height=\"285\" \/><\/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;\">Why Use Standard Deviation?<\/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;\">To compare spread. Two datasets with the same mean can behave very differently, as the machine example shows.<\/li>\n<li style=\"margin: 0 0 8px;\">To judge what is normal. A value within one or two standard deviations of the mean is usual. A value far outside it deserves a look.<\/li>\n<li style=\"margin: 0 0 8px;\">To measure consistency and risk. A low value for a machine means steady output. A high value for an investment means bigger swings.<\/li>\n<li style=\"margin: 0 0 8px;\">As an input to other tools. Z scores, confidence intervals, hypothesis tests and feature scaling all use it.<\/li>\n<\/ul>\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;\">How to Calculate Standard Deviation<\/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;\">Subtract the mean from every value. These are the deviations.<\/li>\n<li style=\"margin: 0 0 8px;\">Square each deviation.<\/li>\n<li style=\"margin: 0 0 8px;\">Add up the squared deviations.<\/li>\n<li style=\"margin: 0 0 8px;\">Divide by N for a population, or by N minus 1 for a sample. This gives the variance.<\/li>\n<li style=\"margin: 0 0 8px;\">Take the square root of the variance.<\/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;\">Standard Deviation Formula<\/h2>\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;\">Population standard deviation: sigma = the square root of [ the sum of (each value minus the mean) squared, divided by N ]<\/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;\">Sample standard deviation: s = the square root of [ the sum of (each value minus the sample mean) squared, divided by (N minus 1) ]<\/div>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/SD.png\" alt=\"Standard deviation formula\" width=\"850\" height=\"364\" \/><\/div>\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;\">Population and sample standard deviation compared<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 260px;\" scope=\"col\">Feature<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Population<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Sample<\/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\">Symbol<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">sigma<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">s<\/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\">Mean symbol<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">mu<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">x bar<\/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\">Divide the sum of squares by<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">N<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">N minus 1<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Use when<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">You have every member of the group<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">You have a part of the group and want to estimate the whole<\/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;\">In real work you almost always have a sample, so you use N minus 1. The reason is explained in our sample variance tutorial. The live version of this page divides by N, which is the population method. That is correct if the dogs are the whole group you care about, and it is not correct if five dogs stand for all dogs. For the dogs, the sample standard deviation is 164.71 mm, against 147.32 mm for the population version.<\/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: Ten Numbers<\/h3>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The data is 4, 2, 3, 5, 2, 2, 6, 1, 4, 2. The sum is 31, and there are 10 values, so the mean is 3.1.<\/p>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/SD1.jpg\" alt=\"Standard deviation example\" width=\"850\" height=\"342\" \/><\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Subtract the mean, 3.1, from every item and square the result.<\/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;\">Ten numbers: difference from the mean, squared<\/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\">Value<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Value minus 3.1<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Squared<\/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\">4<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.9<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.81<\/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\">2<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 1.1<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">1.21<\/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\">3<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 0.1<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.01<\/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\">5<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">1.9<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">3.61<\/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\">2<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 1.1<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">1.21<\/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\">2<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 1.1<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">1.21<\/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\">6<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">2.9<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">8.41<\/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;\">minus 2.1<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">4.41<\/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\">4<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.9<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.81<\/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\">2<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">minus 1.1<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">1.21<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Total<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">0<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">22.9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"margin: 16px 0 24px;\"><img loading=\"lazy\" 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\/standDev1.png\" alt=\"Standard deviation example calculation\" width=\"850\" height=\"332\" \/><\/div>\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 stops here. Here is the finish.<\/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;\">Ten numbers: variance and standard deviation<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 240px;\" scope=\"col\">Measure<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Population (divide by 10)<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Sample (divide by 9)<\/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\">Variance<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">2.29<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">2.54<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Standard deviation<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">1.51<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">1.60<\/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;\">What Does the Number Tell You?<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">A standard deviation has no good or bad value by itself. It must be read against the mean and the context. A standard deviation of 5 mm is huge for a bolt and tiny for the height of a building.<\/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;\">The 68 95 99.7 Rule<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">If the data follows a bell shaped, normal pattern, about 68 percent of values fall within one standard deviation of the mean, about 95 percent within two, and about 99.7 percent within three. I checked this with a simulation of one million normal values with a mean of 100 and a standard deviation of 15.<\/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;\">The 68 95 99.7 rule<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 300px;\" scope=\"col\">Range around the mean<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Share of values<\/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\">Within 1 standard deviation<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">68.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\">Within 2 standard deviations<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">95.4 percent<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Within 3 standard deviations<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">99.7 percent<\/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;\">Use the rule with care. It holds for normal data. For skewed data, such as incomes, the shares are different.<\/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<\/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 says how many standard deviations a value is from the mean. It equals (value minus mean) divided by standard deviation. The 600 mm dog has a z score of (600 minus 394) divided by 147.32 = 1.40. It is 1.4 standard deviations above the mean. A common rule of thumb flags values with a z score beyond 3 as outliers, but it is a guide, not a law.<\/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;\">Comparing Two Machines<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Back to the packets. Five packets from each machine, in grams:<\/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: 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;\">Two machines compared: weights, mean and sample SD<\/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\">Machine<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Weights<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Mean<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Sample SD<\/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\">A<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">49.8, 50.1, 50.0, 49.9, 50.2<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">50.0<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">0.16<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">B<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">47.0, 53.5, 50.2, 46.5, 52.8<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">50.0<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">3.22<\/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;\">Both average 50.0 grams. Machine A has a standard deviation of 0.16 g, and machine B has 3.22 g. Machine B is about 20 times more spread out, and a weight check with a tight limit would reject many of its packets. This is my own example. Only five readings each, so treat it as an illustration, not a quality study.<\/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;\">Calculate Standard Deviation 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;\">Remember the defaults. The statistics module has two functions, stdev for samples and pstdev for populations. NumPy divides by N by default. pandas divides by N minus 1 by default. 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 statistics as st\r\nimport numpy as np\r\nimport pandas as pd\r\n\r\nheights = [600, 470, 170, 430, 300]\r\nprint(\"Population SD:\", round(st.pstdev(heights), 2))\r\nprint(\"Sample SD:\", round(st.stdev(heights), 2))\r\n\r\ndata = [4, 2, 3, 5, 2, 2, 6, 1, 4, 2]\r\nprint(\"numpy default:\", round(float(np.std(data)), 2))\r\nprint(\"numpy ddof=1:\", round(float(np.std(data, ddof=1)), 2))\r\nprint(\"pandas default:\", round(float(pd.Series(data).std()), 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;\">Population SD: 147.32\r\nSample SD: 164.71\r\nnumpy default: 1.51\r\nnumpy ddof=1: 1.6\r\npandas default: 1.6<\/pre>\n<\/div>\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;\">Standard deviation functions in Python libraries<\/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\">Library<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Sample SD<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Population SD<\/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\">statistics<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">stdev()<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">pstdev()<\/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\">NumPy<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">np.std(x, ddof=1)<\/td>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">np.std(x), the default<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">pandas<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Series.std(), the default<\/td>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Series.std(ddof=0)<\/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;\">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: 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;\">Common mistakes and the fix<\/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\">Using the population formula for a sample<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Divide by N minus 1 and use s<\/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 square root, so you report the variance<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Take the square root as the last step<\/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 the sum instead of the mean<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Subtract the mean<\/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 np.std and assuming it is the sample version<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Set ddof=1<\/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\">Applying the 68 95 99.7 rule to skewed data<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Check the shape of the data first<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Calling a standard deviation large or small with no context<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Compare with the mean, or use another dataset<\/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;\">Find the population standard deviation of 2, 4, 4, 4, 5, 5, 7, 9.<\/li>\n<li style=\"margin: 0 0 8px;\">Find the sample standard deviation of 10, 12, 14.<\/li>\n<li style=\"margin: 0 0 8px;\">A dataset has a mean of 60 and a standard deviation of 8. What is the z score of 76?<\/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) Mean 5, squared deviations 9, 1, 1, 1, 0, 0, 4, 16 add to 32, variance 4, standard deviation 2. 2) Mean 12, squares 4, 0, 4 add to 8, divided by 2 gives 4, standard deviation 2. 3) (76 minus 60) divided by 8 = 2. These are my own calculations, so please recheck them before publishing.<\/p>\n<p>Standard deviation turns the question how spread out is my data into a single number you can compare and act on. Calculate a few by hand to build the feel, check whether you need the sample or population version, and then let Python do the work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Standard Deviation: Definition, Formula and Worked Examples Two machines fill 50 gram packets. Over a day, both average exactly 50 grams. One makes packets that all weigh between 49.8 and 50.2. The other makes packets from 46.5 to 53.5. Same average, very different machines. The average cannot tell them apart, and standard deviation can. Standard [&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":[490,492,489,134,133,102,132,491],"class_list":["post-2240","post","type-post","status-publish","format-standard","hentry","category-data-science","category-data-science-modules","tag-example-of-standard-deviation","tag-how-to-calculate-standard-deviation","tag-standard-deviation-definition-in-statistics","tag-standard-deviation-example","tag-standard-deviation-formula","tag-standard-deviation-in-data-science","tag-standard-deviation-tutorial","tag-why-use-standard-deviation"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Standard Deviation: Formula, Examples and Python Code<\/title>\n<meta name=\"description\" content=\"Learn standard deviation with simple definitions, the formula, worked examples, population vs sample, the 68 95 99.7 rule 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\/standard-deviation-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Standard Deviation: Formula, Examples and Python Code\" \/>\n<meta property=\"og:description\" content=\"Learn standard deviation with simple definitions, the formula, worked examples, population vs sample, the 68 95 99.7 rule and Python code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-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-01T10:08:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-02T14:39:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif\" \/>\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=\"9 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\/standard-deviation-tutorial\/\",\"url\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/\",\"name\":\"Standard Deviation: Formula, Examples and Python Code\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif\",\"datePublished\":\"2026-11-01T10:08:40+00:00\",\"dateModified\":\"2026-11-02T14:39:03+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Learn standard deviation with simple definitions, the formula, worked examples, population vs sample, the 68 95 99.7 rule and Python code.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif\",\"width\":612,\"height\":204},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Standard Deviation Tutorial\"}]},{\"@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":"Standard Deviation: Formula, Examples and Python Code","description":"Learn standard deviation with simple definitions, the formula, worked examples, population vs sample, the 68 95 99.7 rule 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\/standard-deviation-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Standard Deviation: Formula, Examples and Python Code","og_description":"Learn standard deviation with simple definitions, the formula, worked examples, population vs sample, the 68 95 99.7 rule and Python code.","og_url":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2026-11-01T10:08:40+00:00","article_modified_time":"2026-11-02T14:39:03+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/","url":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/","name":"Standard Deviation: Formula, Examples and Python Code","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif","datePublished":"2026-11-01T10:08:40+00:00","dateModified":"2026-11-02T14:39:03+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Learn standard deviation with simple definitions, the formula, worked examples, population vs sample, the 68 95 99.7 rule and Python code.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/06\/standDev2.gif","width":612,"height":204},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/standard-deviation-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Standard Deviation Tutorial"}]},{"@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\/2240","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=2240"}],"version-history":[{"count":15,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2240\/revisions"}],"predecessor-version":[{"id":12115,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2240\/revisions\/12115"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=2240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=2240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=2240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}