Return the indices of outliers using the Tukey IQR rule.
Signature: def iqr_outliers(x: list, k: float = 1.5) -> list
Let Q1 and Q3 be the 25th and 75th percentiles, IQR = Q3 - Q1. An index i is an outlier if:
x[i] < Q1 - k * IQR or x[i] > Q3 + k * IQR
Return indices in ascending order.
Math
Asked at
import numpy as np
def iqr_outliers(...):
pass
Premium problem
Free accounts include problems #1–20. Upgrade to unlock the editor, hidden test cases, and reference solutions for every problem.
Already premium?