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
15fb45eb
Commit
15fb45eb
authored
5 years ago
by
iregon
Browse files
Options
Download
Email Patches
Plain Diff
Decoders output type in now only object
parent
53274594
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
common/decoders.py
common/decoders.py
+3
-5
No files found.
common/decoders.py
View file @
15fb45eb
...
...
@@ -58,17 +58,15 @@ def signed_overpunch_i(x):
class
df_decoders
():
def
__init__
(
self
,
dtype
):
self
.
dtype
=
dtype
if
dtype
in
properties
.
numeric_types
else
'object'
# Return as object, conversion to actual type in converters only!
self
.
dtype
=
'object'
def
signed_overpunch
(
self
,
data
):
decoded_numeric
=
np
.
vectorize
(
signed_overpunch_i
,
otypes
=
[
float
])(
data
)
return
pd
.
Series
(
decoded_numeric
,
dtype
=
self
.
dtype
)
def
base36
(
self
,
data
):
# Caution: int(str(np.nan),36) ==> 30191
if
self
.
dtype
==
'object'
:
base10
=
[
str
(
int
(
str
(
i
),
36
))
if
i
==
i
and
i
else
np
.
nan
for
i
in
data
]
else
:
base10
=
[
int
(
str
(
i
),
36
)
if
i
==
i
and
i
else
np
.
nan
for
i
in
data
]
base10
=
[
str
(
int
(
str
(
i
),
36
))
if
i
==
i
and
i
else
np
.
nan
for
i
in
data
]
return
pd
.
Series
(
base10
,
dtype
=
self
.
dtype
)
...
...
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