From 8285bdb423f583447aeadfd4aefe5a31ad59a0a9 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Mon, 23 May 2022 19:45:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20ALTO:=20Calculate=20more=20descr?= =?UTF-8?q?iptive=20statistics=20for=20String@WC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qurator/modstool/lib.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qurator/modstool/lib.py b/qurator/modstool/lib.py index 383ba8f..b3ce44f 100644 --- a/qurator/modstool/lib.py +++ b/qurator/modstool/lib.py @@ -221,7 +221,12 @@ class TagGroup: values = np.array([float(v) for v in values]) statistics = {} - statistics[f'{xpath_expr}-mean'] = np.mean(values) + if values.size > 0: + statistics[f'{xpath_expr}-mean'] = np.mean(values) + statistics[f'{xpath_expr}-median'] = np.median(values) + statistics[f'{xpath_expr}-std'] = np.std(values) + statistics[f'{xpath_expr}-min'] = np.min(values) + statistics[f'{xpath_expr}-max'] = np.max(values) return statistics