From 10c8a694f2ffcfc001f5deddcb7d633d9f00b7cc Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 5 Sep 2016 17:05:03 +0200 Subject: Operation: display statistics on the sheet (refs #2989) --- ishtar_common/utils.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 9fe7a3a00..d4973012e 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -56,3 +56,8 @@ def shortify(lbl, number=20): if len(lbl) <= number: return lbl return lbl[:number - len(SHORTIFY_STR)] + SHORTIFY_STR + + +def mode(array): + most = max(list(map(array.count, array))) + return list(set(filter(lambda x: array.count(x) == most, array))) -- cgit v1.2.3