Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
brivas
mdf_reader
Commits
e2ecea16
Commit
e2ecea16
authored
5 years ago
by
iregon
Browse files
Options
Download
Email Patches
Plain Diff
Work internally only with nullable pandas integers
parent
a4364b98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
data_models/schemas.py
data_models/schemas.py
+5
-0
properties.py
properties.py
+6
-0
No files found.
data_models/schemas.py
View file @
e2ecea16
...
...
@@ -115,6 +115,11 @@ def read_schema(schema_name = None, ext_schema_path = None):
if
not
schema
[
'sections'
][
section
][
'header'
].
get
(
'field_layout'
):
delimiter
=
schema
[
'sections'
][
section
][
'header'
].
get
(
'delimiter'
)
schema
[
'sections'
][
section
][
'header'
][
'field_layout'
]
=
'delimited'
if
delimiter
else
'fixed_width'
for
element
in
schema
[
'sections'
][
section
][
'elements'
].
keys
():
if
schema
[
'sections'
][
section
][
'elements'
][
element
].
get
(
'column_type'
)
in
properties
.
numpy_integers
:
np_integer
=
schema
[
'sections'
][
section
][
'elements'
][
element
].
get
(
'column_type'
)
pd_integer
=
properties
.
pandas_nan_integers
.
get
(
np_integer
)
schema
[
'sections'
][
section
][
'elements'
][
element
].
update
({
'column_type'
:
pd_integer
})
return
schema
else
:
logging
.
error
(
'Multile reports per line data model: not yet supported'
)
...
...
This diff is collapsed.
Click to expand it.
properties.py
View file @
e2ecea16
...
...
@@ -17,8 +17,14 @@ supported_data_models = [ os.path.basename(x).split(".")[0] for x in glob.glob(s
# Data types ------------------------------------------------------------------
numpy_integers
=
[
'int8'
,
'int16'
,
'int32'
,
'int64'
,
'uint8'
,
'uint16'
,
'uint32'
,
'uint64'
]
numpy_floats
=
[
'float16'
,
'float32'
,
'float64'
]
pandas_nan_integers
=
{
'int8'
:
'Int8'
,
'int16'
:
'Int16'
,
'int32'
:
'Int32'
,
'int64'
:
'Int64'
,
'uint8'
:
'UInt8'
,
'uint16'
:
'UInt16'
,
'uint32'
:
'UInt32'
,
'uint64'
:
'UInt64'
}
numeric_types
=
numpy_integers
.
copy
()
numeric_types
.
extend
(
numpy_floats
)
numeric_types
.
extend
(
pandas_nan_integers
.
values
())
object_types
=
[
'str'
,
'object'
,
'key'
,
'datetime'
]
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment