Skip to content

Commit

Permalink
allow loading of broken csv files by skipping lines with missing entries
Browse files Browse the repository at this point in the history
  • Loading branch information
P-Schumacher authored and Pierre Schumacher committed Mar 13, 2024
1 parent 2683b0b commit e21b4c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deprl/vendor/tonic/utils/csv_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def load_csv_to_dict(csv_path):
data = load_csv(csv_path)
keys = data[0]
data = data[1:]
data = [list(map(float, x)) for x in data if x[0] != "None"]
data = [list(map(float, x)) for x in data if x[0] != "None" and all(val != '' for val in x)]
data = {k: [x[idx] for x in data] for idx, k in enumerate(keys)}
return data

0 comments on commit e21b4c4

Please sign in to comment.