Skip to content
Snippets Groups Projects
Commit 5cbd9a40 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: refactor for missing obligatory columns

parent 1b7e2bb7
No related branches found
No related tags found
2 merge requests!73MAINT: change wording of TableImporter argument and allow converters and...,!70ENH: allow to provide required columns explicitly
Pipeline #35533 passed
...@@ -373,24 +373,20 @@ class TableImporter(): ...@@ -373,24 +373,20 @@ class TableImporter():
for index, row in df.iterrows(): for index, row in df.iterrows():
# if none of the relevant information is given, skip # if none of the relevant information is given, skip
if pd.isnull(row.loc[[key for key in self.obligatory_columns if key in df.columns]]).all():
if np.array([pd.isnull(row.loc[key]) for key in self.obligatory_columns
if key in df.columns]).all():
df = df.drop(index) df = df.drop(index)
continue continue
# if any of the relevant information is missing, report it # if any of the relevant information is missing, report it
i = 0 i = 0
okay = True okay = True
while okay and i < len(self.obligatory_columns): while okay and i < len(self.obligatory_columns):
key = self.obligatory_columns[i] key = self.obligatory_columns[i]
i += 1
if key not in df.columns: if key not in df.columns:
continue continue
i += 1
if pd.isnull(row.loc[key]): if pd.isnull(row.loc[key]):
errmsg = ( errmsg = (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment