mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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.
This commit is contained in:
@@ -14,7 +14,10 @@ def get_data(input_file, before_column, after_column):
|
||||
for row in csv.DictReader(input_file):
|
||||
before = float(row[before_column])
|
||||
after = float(row[after_column])
|
||||
delta = after / before
|
||||
if before > 0:
|
||||
delta = after / before
|
||||
else:
|
||||
delta = 1
|
||||
yield delta
|
||||
|
||||
def f(input_data):
|
||||
|
||||
Reference in New Issue
Block a user