Skip to content
Justice Tech School

Practice: Normalise Data

Scale values to 0 to 1 and standardise with the mean and std.

Example
a = np.array([10, 20, 30, 40, 50], dtype=float)
mm = (a - a.min()) / (a.max() - a.min())
z = (a - a.mean()) / a.std()
print(mm)
print(z.round(2))

Result

[0.   0.25 0.5  0.75 1.  ]
[-1.41 -0.71  0.    0.71  1.41]

Exercise

Smallest value.

a.()

Quiz Test

What does min max scaling give?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.