在[quant]字段中找到大于或等于(337)的值的平均值,这是定量字段
quant
100
7
109
204
28
292
105
254
441
401
410
14
15
51
96
403
75
31
109
17
Run Code Online (Sandbox Code Playgroud)
这是我试过的代码
import csv
total = count = 0
with open('3111111a.csv', newline='') as f:
reader = csv.reader(f)
next(reader, None)
for row in reader:
total += float(row[4])
count += 1
if count:
average = total / count
print('The average of the values is {}'.format(average))
Run Code Online (Sandbox Code Playgroud)