Skip to content

Commit da385bd

Browse files
committed
[csvcolumn_to_scurve] Avoid division by zero.
Check whether the value in the "before" column is zero (specifically, whether the file size in that column is greater than zero since filesizes are non-negative) before dividing the value in the "after" column by it.
1 parent 3ec5e76 commit da385bd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

utils/dev-scripts/csvcolumn_to_scurve.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def get_selected_csv_rows(input_file, before_column, after_column):
1414
for row in csv.DictReader(input_file):
1515
before = float(row[before_column])
1616
after = float(row[after_column])
17-
delta = after / before
17+
if before > 0:
18+
delta = after / before
19+
else:
20+
delta = 1
1821
yield delta
1922

2023
def f(input_data):

0 commit comments

Comments
 (0)