Outlier Flags: IQR and Z-Score

easy
Unit 7 · Interpretability I0/5 to milestone

Implement two common outlier rules, each returning a boolean mask:

  • iqr_outliers(x, k=1.5): outside [Q1 - k·IQR, Q3 + k·IQR], with quartiles from np.percentile (default linear interpolation)
  • zscore_outliers(x, threshold=3.0): |x - mean| / std > threshold (population std). A constant array has no outliers.
#outliers#statistics#data-quality2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Outlier Flags: IQR and Z-Score · TechGradify