Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
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 Crawler
Commits
db4e6348
Verified
Commit
db4e6348
authored
10 months ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Trying out the other backend.
parent
23c232cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!171
sav/spss converter
Pipeline
#52032
passed
10 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/caoscrawler/conv_impl/spss.py
+3
-1
3 additions, 1 deletion
src/caoscrawler/conv_impl/spss.py
src/caoscrawler/converters.py
+1
-1
1 addition, 1 deletion
src/caoscrawler/converters.py
unittests/test_spss_converter.py
+4
-3
4 additions, 3 deletions
unittests/test_spss_converter.py
with
8 additions
and
5 deletions
src/caoscrawler/conv_impl/spss.py
+
3
−
1
View file @
db4e6348
...
@@ -47,7 +47,9 @@ class SPSSConverter(converters.TableConverter):
...
@@ -47,7 +47,9 @@ class SPSSConverter(converters.TableConverter):
def
create_children
(
self
,
values
:
GeneralStore
,
element
:
StructureElement
)
->
list
:
def
create_children
(
self
,
values
:
GeneralStore
,
element
:
StructureElement
)
->
list
:
assert
isinstance
(
element
,
File
)
assert
isinstance
(
element
,
File
)
df
=
pd
.
io
.
spss
.
read_spss
(
element
.
path
)
# The default dtype backend "numpy_nullable" does not handle dates well.
# Note that pandas.ArrowDtype is considered experimental (in Pandas 2.2).
df
=
pd
.
io
.
spss
.
read_spss
(
element
.
path
,
dtype_backend
=
"
pyarrow
"
)
# if element.path.endswith(".sav"):
# if element.path.endswith(".sav"):
# sav_df, meta = pyreadstat.read_sav(element.path, metadataonly=True)
# sav_df, meta = pyreadstat.read_sav(element.path, metadataonly=True)
...
...
This diff is collapsed.
Click to expand it.
src/caoscrawler/converters.py
+
1
−
1
View file @
db4e6348
...
@@ -188,7 +188,7 @@ out: tuple
...
@@ -188,7 +188,7 @@ out: tuple
if
"
value
"
not
in
value
:
if
"
value
"
not
in
value
:
# TODO: how do we handle this case? Just ignore?
# TODO: how do we handle this case? Just ignore?
# or disallow?
# or disallow?
raise
NotImplementedError
()
raise
NotImplementedError
(
f
"
This definition has no
\"
value
\"
:
{
value
}
"
)
propvalue
=
value
[
"
value
"
]
propvalue
=
value
[
"
value
"
]
# can be "single", "list" or "multiproperty"
# can be "single", "list" or "multiproperty"
collection_mode
=
value
[
"
collection_mode
"
]
collection_mode
=
value
[
"
collection_mode
"
]
...
...
This diff is collapsed.
Click to expand it.
unittests/test_spss_converter.py
+
4
−
3
View file @
db4e6348
...
@@ -62,7 +62,7 @@ def test_spss_converter(converter_registry):
...
@@ -62,7 +62,7 @@ def test_spss_converter(converter_registry):
spss_dir
=
UNITTESTDIR
/
"
test_tables
"
/
"
spss
"
spss_dir
=
UNITTESTDIR
/
"
test_tables
"
/
"
spss
"
for
sav_file
,
length
,
thistype
in
[
for
sav_file
,
length
,
thistype
in
[
(
File
(
"
sample.sav
"
,
spss_dir
/
"
sample.sav
"
),
5
,
str
),
(
File
(
"
sample.sav
"
,
spss_dir
/
"
sample.sav
"
),
5
,
str
),
(
File
(
"
sample.sav
"
,
spss_dir
/
"
sample_large.sav
"
),
485
,
floa
t
),
(
File
(
"
sample.sav
"
,
spss_dir
/
"
sample_large.sav
"
),
485
,
in
t
),
]:
]:
m
=
converter
.
match
(
sav_file
)
m
=
converter
.
match
(
sav_file
)
assert
m
is
not
None
assert
m
is
not
None
...
@@ -70,6 +70,7 @@ def test_spss_converter(converter_registry):
...
@@ -70,6 +70,7 @@ def test_spss_converter(converter_registry):
children
=
converter
.
create_children
(
None
,
sav_file
)
children
=
converter
.
create_children
(
None
,
sav_file
)
assert
len
(
children
)
==
length
assert
len
(
children
)
==
length
for
ii
,
child
in
enumerate
(
children
):
for
ii
,
child
in
enumerate
(
children
):
assert
child
.
__class__
==
DictElement
assert
child
.
__class__
==
DictElement
assert
child
.
name
==
str
(
ii
)
assert
child
.
name
==
str
(
ii
)
...
@@ -78,5 +79,5 @@ def test_spss_converter(converter_registry):
...
@@ -78,5 +79,5 @@ def test_spss_converter(converter_registry):
assert
isinstance
(
my_dict
[
"
mydate
"
],
datetime
.
date
)
or
np
.
isnan
(
my_dict
[
"
mydate
"
])
assert
isinstance
(
my_dict
[
"
mydate
"
],
datetime
.
date
)
or
np
.
isnan
(
my_dict
[
"
mydate
"
])
assert
isinstance
(
my_dict
[
"
dtime
"
],
datetime
.
datetime
)
or
np
.
isnan
(
my_dict
[
"
dtime
"
])
assert
isinstance
(
my_dict
[
"
dtime
"
],
datetime
.
datetime
)
or
np
.
isnan
(
my_dict
[
"
dtime
"
])
assert
isinstance
(
my_dict
[
"
mytime
"
],
datetime
.
time
)
or
np
.
isnan
(
my_dict
[
"
mytime
"
])
assert
isinstance
(
my_dict
[
"
mytime
"
],
datetime
.
time
)
or
np
.
isnan
(
my_dict
[
"
mytime
"
])
assert
isinstance
(
my_dict
[
"
mylabl
"
],
thistype
)
assert
isinstance
(
my_dict
[
"
mylabl
"
],
thistype
)
,
f
"
{
type
(
my_dict
[
'
mylabl
'
])
}
"
assert
isinstance
(
my_dict
[
"
myord
"
],
thistype
)
assert
isinstance
(
my_dict
[
"
myord
"
],
thistype
)
,
f
"
{
type
(
my_dict
[
'
myord
'
])
}
"
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