From f533aa94b9af11337edf62ee205c758b5bbfb168 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Thu, 13 Apr 2023 11:17:29 +0200
Subject: [PATCH] MAINT: clarify difference between old and new behavior

---
 CHANGELOG.md                            | 2 --
 src/caosadvancedtools/table_importer.py | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c948dcd7..2317fa8c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,8 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Changed ###
 - The converters and datatype arguments of TableImporter now may have keys for nonexisting columns
-- The obligatory key word no longer enforces that the columns exist. Since all rows are still
-  checked whether this column has a non-NULL value, this is deemed a non breaking change.
 
 ### Deprecated ###
 
diff --git a/src/caosadvancedtools/table_importer.py b/src/caosadvancedtools/table_importer.py
index f38c3ffc..025533b3 100755
--- a/src/caosadvancedtools/table_importer.py
+++ b/src/caosadvancedtools/table_importer.py
@@ -221,7 +221,7 @@ class TableImporter():
           value check is not necessary.
 
         obligatory_columns : list, optional
-          List of column names that must not have missing values.
+          List of column names that (if they exist) must not have missing values.
 
         unique_keys : list, optional
           List of column names that in combination must be unique: each row has a unique
@@ -387,6 +387,8 @@ class TableImporter():
 
             while okay and i < len(self.obligatory_columns):
                 key = self.obligatory_columns[i]
+                if key not in df.columns:
+                    continue
                 i += 1
 
                 if pd.isnull(row.loc[key]):
-- 
GitLab