From 52e886af6de6b2c95974579a9a6d298ff625c6e2 Mon Sep 17 00:00:00 2001 From: Stijn Van Hoey Date: Wed, 17 Apr 2024 22:32:25 +0200 Subject: [PATCH] Update goruping and name --- niche_vlaanderen/codetables.py | 6 +++++- tests/test_validation.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/niche_vlaanderen/codetables.py b/niche_vlaanderen/codetables.py index 04d81b3c..fe31be89 100644 --- a/niche_vlaanderen/codetables.py +++ b/niche_vlaanderen/codetables.py @@ -45,7 +45,11 @@ def check_lower_upper_boundaries(df, min_col, max_col, value): """ group_cols = set(df.columns.tolist()) - {min_col, max_col, value} - for sel_group, subtable in df.groupby(list(group_cols)): + if len(list(group_cols)) > 0: + groups = list(group_cols) + else: + groups = list(group_cols)[0] + for sel_group, subtable in df.groupby(groups): min_values = subtable[min_col] max_values = subtable[max_col] for (i, index) in enumerate(min_values.index): diff --git a/tests/test_validation.py b/tests/test_validation.py index 66776a65..3cd35d0b 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -11,6 +11,7 @@ def test_validation(zwarte_beek_niche, path_testdata): myniche = zwarte_beek_niche() + myniche.name = "zwarte beek" myniche.run() no = NicheValidation(