3. Standardise with NumPy (z-scores)
EasyPandas & NumPy
Given a list of numbers, return their z-scores, (x − mean) / std using the population standard deviation, rounded to 3 decimals. If every value is equal, return zeros.
Example 1
Input: [2, 4, 4, 4, 5, 5, 7, 9] Output: [-1.5, -0.5, -0.5, -0.5, 0.0, 0.0, 1.0, 2.0]
Constraints
1 ≤ n ≤ 10⁵