Standard Scores
import pandas as pd
standard_score = pd.DataFrame({"subject": ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"],
"raw score": [10, 9, 3, 10, 9, 2, 2, 10, 5, 5,
1, 6, 8, 6, 6, 1, 3, 6, 10, 8]})
standard_score
| subject | raw score | |
|---|---|---|
| 0 | A | 10 |
| 1 | B | 9 |
| 2 | C | 3 |
| 3 | D | 10 |
| 4 | E | 9 |
| 5 | F | 2 |
| 6 | G | 2 |
| 7 | H | 10 |
| 8 | I | 5 |
| 9 | J | 5 |
| 10 | K | 1 |
| 11 | L | 6 |
| 12 | M | 8 |
| 13 | N | 6 |
| 14 | O | 6 |
| 15 | P | 1 |
| 16 | Q | 3 |
| 17 | R | 6 |
| 18 | S | 10 |
| 19 | T | 8 |
mean = 6
sd = 3.18
computing standard score
def score_calculate(raw_score):
return round(((raw_score - mean) / sd), 2)
standard_score["standard score"] = standard_score["raw score"].apply(score_calculate)
standard_score
| subject | raw score | standard score | |
|---|---|---|---|
| 0 | A | 10 | 1.26 |
| 1 | B | 9 | 0.94 |
| 2 | C | 3 | -0.94 |
| 3 | D | 10 | 1.26 |
| 4 | E | 9 | 0.94 |
| 5 | F | 2 | -1.26 |
| 6 | G | 2 | -1.26 |
| 7 | H | 10 | 1.26 |
| 8 | I | 5 | -0.31 |
| 9 | J | 5 | -0.31 |
| 10 | K | 1 | -1.57 |
| 11 | L | 6 | 0.00 |
| 12 | M | 8 | 0.63 |
| 13 | N | 6 | 0.00 |
| 14 | O | 6 | 0.00 |
| 15 | P | 1 | -1.57 |
| 16 | Q | 3 | -0.94 |
| 17 | R | 6 | 0.00 |
| 18 | S | 10 | 1.26 |
| 19 | T | 8 | 0.63 |
mean of standard score
round(standard_score["standard score"].mean(), 2)
0.0
standard deviation of standard score
round(standard_score["standard score"].std(), 2)
1.0