From 5cbd9a400d453993cafd6b56349a2301ded6f78d 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:53:12 +0200
Subject: [PATCH] MAINT: refactor for missing obligatory columns

---
 src/caosadvancedtools/table_importer.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/caosadvancedtools/table_importer.py b/src/caosadvancedtools/table_importer.py
index 56530879..8f793584 100755
--- a/src/caosadvancedtools/table_importer.py
+++ b/src/caosadvancedtools/table_importer.py
@@ -373,24 +373,20 @@ class TableImporter():
 
         for index, row in df.iterrows():
             # if none of the relevant information is given, skip
-
-            if np.array([pd.isnull(row.loc[key]) for key in self.obligatory_columns
-                         if key in df.columns]).all():
-
+            if pd.isnull(row.loc[[key for key in self.obligatory_columns if key in df.columns]]).all():
                 df = df.drop(index)
 
                 continue
 
             # if any of the relevant information is missing, report it
-
             i = 0
             okay = True
 
             while okay and i < len(self.obligatory_columns):
                 key = self.obligatory_columns[i]
+                i += 1
                 if key not in df.columns:
                     continue
-                i += 1
 
                 if pd.isnull(row.loc[key]):
                     errmsg = (
-- 
GitLab