Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
uahil
CPUnetPLOT
Commits
d679de0f
Commit
d679de0f
authored
Aug 11, 2014
by
Mario Hock
Browse files
get_csv_columns
parent
5bf8866a
Changes
1
Hide whitespace changes
Inline
Side-by-side
cnl_library.py
View file @
d679de0f
...
...
@@ -111,8 +111,33 @@ class CNLParser:
Dict-keys correspond to |self.csv_header|, if |fields| is set only the specified columns are included.
"""
## TODO
pass
## TODO should we really use "get_..." for an I/O and computation intensive function..?
if
(
fields
):
field_names
=
fields
else
:
field_names
=
self
.
csv_header
num_cols
=
len
(
field_names
)
## Create a list for each column.
cols
=
[
list
()
for
i
in
range
(
num_cols
)
]
## Read all csv lines and put the values in the corresponding columns,
for
line
in
self
.
get_csv_iterator
(
fields
):
for
i
in
range
(
num_cols
):
cols
[
i
].
append
(
line
[
i
]
)
## Create output dictionary.
ret
=
dict
()
for
i
in
range
(
num_cols
):
ret
[
field_names
[
i
]
]
=
cols
[
i
]
return
ret
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment