From ed795642369bc418b3814f40af342add67233047 Mon Sep 17 00:00:00 2001 From: pswain <peter.swain@ed.ac.uk> Date: Fri, 15 Dec 2023 18:08:13 +0000 Subject: [PATCH] fix(grouper): perform check if dataframe is None --- src/postprocessor/grouper.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/postprocessor/grouper.py b/src/postprocessor/grouper.py index 0dca70e..ac82858 100644 --- a/src/postprocessor/grouper.py +++ b/src/postprocessor/grouper.py @@ -289,15 +289,17 @@ def concat_one_signal( combined = position.get_raw(path, **kwargs) elif mode == "daughters": combined = position.get_raw(path, lineage=True, **kwargs) - combined = combined.loc[ - combined.index.get_level_values("mother_label") > 0 - ] + if combined is not None: + combined = combined.loc[ + combined.index.get_level_values("mother_label") > 0 + ] elif mode == "mothers": combined = position.get_raw(path, lineage=True, **kwargs) - combined = combined.loc[ - combined.index.get_level_values("mother_label") == 0 - ] - combined = combined.droplevel("mother_label") + if combined is not None: + combined = combined.loc[ + combined.index.get_level_values("mother_label") == 0 + ] + combined = combined.droplevel("mother_label") elif mode == "families": combined = position[path] else: -- GitLab