diff --git a/CHANGES.md b/CHANGES.md index 3b74903c..6414b218 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,8 @@ Changes since v2.1.0 include: +- Fix crash on summary output when numpy is not installed. + # Flent v2.1.0 # Released on 2022-11-02. diff --git a/flent/combiners.py b/flent/combiners.py index ca133ce8..90e17462 100644 --- a/flent/combiners.py +++ b/flent/combiners.py @@ -606,6 +606,9 @@ class Pct99Reducer(TryReducer): raw_key = "pct99" def _reduce(self, data): + if not HAS_NUMPY: + return sorted(data)[-(len(data) // 100 + 1)] + return np.percentile(data, 99) class CumsumReducer(TryReducer): @@ -740,6 +743,9 @@ def _reduce(self, data): class RawPct99Reducer(RawReducer): def _reduce(self, data): + if not HAS_NUMPY: + return sorted(data)[-(len(data) // 100 + 1)] + return np.percentile(data, 99) class RawCumsumReducer(RawReducer):