def sumRows(filename, header=False):
d = {}
total = 0
with open ('{0}'.format(filename)) as csvfile:
rdr = csv.reader(csvfile)
for row in rdr:
if(header==True):
rdr.next()
# skips first row if header is set to true
continue
total = ?
# function I do not know how to do
d[row[0]] = total
print(d)
예 파이썬에서 CSV 파일의 행을 추가 : 밥,CSV 파일의
bob 15 4 4
tim 29 0
anna 18 9
나는 그것이 같은 행을 추가 할 필요는 15 + 4 + 4 팀이해야해야 29 + 0 그리고 어떤 공백을 무시해야합니다, 아무도 내가 파이썬 3에서 어떻게 할 수있는 아이디어가 있습니까? 당신은 팬더를 사용할 수있는 경우는, 사전