From 1849017494b78aafdc8e8d2b88e5c18f89870486 Mon Sep 17 00:00:00 2001 From: jepegit Date: Sun, 26 Jan 2025 18:15:03 +0100 Subject: [PATCH] group_it check for summary collectors --- cellpy/utils/helpers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cellpy/utils/helpers.py b/cellpy/utils/helpers.py index 6514fe1e..a0910a59 100644 --- a/cellpy/utils/helpers.py +++ b/cellpy/utils/helpers.py @@ -888,10 +888,20 @@ def concat_summaries( if only_selected and "selected" in pages.columns: pages = pages.loc[pages.selected == 1, :].copy() + if group_it: + g = pages.groupby("group") + for gno, b_sub in g: + if len(b_sub) < 2: + print("Can not group with less than two cells") + print("Setting group_it to False") + group_it = False + break + if group_it: g = pages.groupby("group") # this ensures that order is kept and grouping is correct # it is therefore ok to assume from now on that all the cells within a list belongs to the same group + for gno, b_sub in g: cell_names_nest.append(list(b_sub.index)) group_nest.append(gno)