mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-27 22:11:13 +00:00
small bugfix
This commit is contained in:
parent
ee005932d1
commit
015c6cf0c3
|
@ -9,6 +9,9 @@ def read_csv(csv_path):
|
|||
data = {i:[] for i in header}
|
||||
for line in in_csv:
|
||||
line = line.strip().split(',')
|
||||
for i in range(len(line)-1):
|
||||
data[header[i]].append(line[i])
|
||||
for i in range(len(line)):
|
||||
try:
|
||||
data[header[i]].append(float(line[i]))
|
||||
except ValueError:
|
||||
data[header[i]].append(line[i])
|
||||
return data
|
||||
|
|
Loading…
Reference in New Issue
Block a user