fix: isolate production universe in capacity research
This commit is contained in:
@@ -225,8 +225,15 @@ def percentile(values: Iterable[float], probability: float) -> float | None:
|
||||
|
||||
|
||||
def iqr(values: Iterable[float]) -> float | None:
|
||||
q25 = percentile(values, 0.25)
|
||||
q75 = percentile(values, 0.75)
|
||||
clean: list[float] = []
|
||||
for value in values:
|
||||
if value is None:
|
||||
continue
|
||||
parsed = float(value)
|
||||
if math.isfinite(parsed):
|
||||
clean.append(parsed)
|
||||
q25 = percentile(clean, 0.25)
|
||||
q75 = percentile(clean, 0.75)
|
||||
if q25 is None or q75 is None:
|
||||
return None
|
||||
return q75 - q25
|
||||
|
||||
Reference in New Issue
Block a user