Skip to content
Snippets Groups Projects
Commit 7f0e3c98 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-fix-array-check' into 'dev'

F fix array check

See merge request !74
parents 816db639 4cafaaf9
No related branches found
No related tags found
2 merge requests!89ENH: JsonSchemaExporter accepts do_not_create parameter.,!74F fix array check
Pipeline #39840 passed
......@@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ###
* `TableImporter.check_missing` in case of array-valued fields in table
### Security ###
### Documentation ###
......
......@@ -388,7 +388,8 @@ class TableImporter():
if key not in df.columns:
continue
if pd.isnull(row.loc[key]):
null_check = pd.isnull(row.loc[key])
if (isinstance(null_check, np.ndarray) and null_check.any()) or (not isinstance(null_check, np.ndarray) and null_check):
errmsg = (
"Required information is missing ({}) in {}. row"
" (without header) of "
......
......@@ -181,6 +181,15 @@ class TableImporterTest(unittest.TestCase):
self.assertEqual(df_new.shape[1], 4)
self.assertEqual(df_new.iloc[0].b, 5)
# check that missing array-valued fields are detected correctly:
df = pd.DataFrame([[[None, None], 4, 2.0, 'yes'],
['b', 5, 3.0, 'no']],
columns=['a', 'b', 'c', 'd'])
df_new = importer.check_missing(df)
self.assertEqual(df_new.shape[0], 1)
self.assertEqual(df_new.shape[1], 4)
self.assertEqual(df_new.iloc[0].b, 5)
def test_wrong_datatype(self):
importer = TableImporter(**self.importer_kwargs)
df = pd.DataFrame([[None, np.nan, 2.0, 'yes'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment