From 85ba3b5e22cad2aec8555e7d0140e862dfdda6b0 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Wed, 12 Oct 2022 15:59:03 -0700 Subject: [PATCH] Followup to previous changes in math_utils; have the code use its own len. --- src/pyutils/math_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pyutils/math_utils.py b/src/pyutils/math_utils.py index ce9940d..6f04290 100644 --- a/src/pyutils/math_utils.py +++ b/src/pyutils/math_utils.py @@ -89,7 +89,7 @@ class NumericPopulation(object): def get_mean(self) -> float: """Returns the mean (arithmetic mean) so far in O(1) time.""" - count = len(self.lowers) + len(self.highers) + count = len(self) return self.aggregate / count def get_mode(self) -> Tuple[float, int]: @@ -133,7 +133,7 @@ class NumericPopulation(object): """ if n == 50: return self.get_median() - count = len(self.lowers) + len(self.highers) + count = len(self) self._create_sorted_copy_if_needed(count) assert self.sorted_copy index = round(count * (n / 100.0)) -- 2.46.0