Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
7f0e3c98
Commit
7f0e3c98
authored
1 year ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-fix-array-check' into 'dev'
F fix array check See merge request
!74
parents
816db639
4cafaaf9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!89
ENH: JsonSchemaExporter accepts do_not_create parameter.
,
!74
F fix array check
Pipeline
#39840
passed
1 year ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
3
Pipelines
44
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
src/caosadvancedtools/table_importer.py
+2
-1
2 additions, 1 deletion
src/caosadvancedtools/table_importer.py
unittests/test_table_importer.py
+9
-0
9 additions, 0 deletions
unittests/test_table_importer.py
with
13 additions
and
1 deletion
CHANGELOG.md
+
2
−
0
View file @
7f0e3c98
...
...
@@ -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 ###
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/table_importer.py
+
2
−
1
View file @
7f0e3c98
...
...
@@ -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
"
...
...
This diff is collapsed.
Click to expand it.
unittests/test_table_importer.py
+
9
−
0
View file @
7f0e3c98
...
...
@@ -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
'
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment