Guest User

Untitled

a guest
May 20th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. import csv
  2.  
  3. quantities = csv.reader(open("quants.csv", "r"))
  4. report = list(quantities)
  5. new_list = []
  6.  
  7. for x in report:
  8.     count = 0
  9.     total = 0
  10.     while count<len(report):
  11.         if report[count][0]==x[0]:
  12.             total = total+(int(report[count][1]))
  13.         count+=1
  14.     new_list.append([x[0], total])
  15. print dict(new_list)
Add Comment
Please, Sign In to add comment