Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
V
Variable derivation
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Uncover
Variable derivation
Commits
d67e646b
Commit
d67e646b
authored
Nov 15, 2021
by
Alberto Blázquez Herranz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed nan issues.
parent
b5ea0ecf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
__pycache__/numeric_converter.cpython-37.pyc
__pycache__/numeric_converter.cpython-37.pyc
+0
-0
numeric_converter.py
numeric_converter.py
+3
-2
No files found.
__pycache__/numeric_converter.cpython-37.pyc
View file @
d67e646b
No preview for this file type
numeric_converter.py
View file @
d67e646b
...
...
@@ -7,6 +7,7 @@ Created on Wed Nov 10 11:52:54 2021
import
pandas
as
pd
import
sys
import
math
'''
datafile_path = sys.argv[1]
csv_separator = ","
...
...
@@ -43,14 +44,14 @@ def numeric_conversion(datafile):
for
col
in
verify_num_col
:
datafile
[
col
]
=
[
float
(
x
)
for
x
in
datafile
[
col
]]
datafile
[
col
]
=
[
float
(
x
)
if
not
math
.
isnan
(
x
)
else
None
for
x
in
datafile
[
col
]]
verify_cat_col
=
[
x
for
x
in
datafile
.
columns
if
x
in
categorical_variables
]
for
col
in
verify_cat_col
:
datafile
[
col
]
=
[
str
(
x
)
for
x
in
datafile
[
col
]]
datafile
[
col
]
=
[
str
(
x
)
if
not
math
.
isnan
(
x
)
else
None
for
x
in
datafile
[
col
]]
#new_datafile_path = datafile_path.replace(".csv", "_numeric.csv")
#datafile.to_csv(new_datafile_path, index = False, quoting=csv.QUOTE_NONNUMERIC)
...
...
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