Skip to content

Commit 015c6cf

Browse files
committed
small bugfix
1 parent ee00593 commit 015c6cf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

read_csv_to_dict.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ def read_csv(csv_path):
99
data = {i:[] for i in header}
1010
for line in in_csv:
1111
line = line.strip().split(',')
12-
for i in range(len(line)-1):
13-
data[header[i]].append(line[i])
12+
for i in range(len(line)):
13+
try:
14+
data[header[i]].append(float(line[i]))
15+
except ValueError:
16+
data[header[i]].append(line[i])
1417
return data

0 commit comments

Comments
 (0)