(198) から (272) までの範囲のフィールド [quant] の数値の平均値は?
quant
95
189
176
200
177
340
205
203
284
88
109
83
360
67
250
56
111
439
354
143
これは私が試したコードです。上記は、平均を見つける必要がある [quant] フィールドです。
word_file = open('300000a.csv','r')
firstLine = True
for line in word_file:
if firstLine:
firstLine = False
continue
line = line.strip()
line = line.split (",")
field = int(line[0])
TotalMetalCount +=1
if field >198 or field <272:
metalCounts += 1
else:
metalCounts = 1
countT +=1
if field >198 or field <272:
count += 1