Skip to content

Instantly share code, notes, and snippets.

@grafuls
Created September 30, 2014 18:03
Show Gist options
  • Save grafuls/48eae8ea0ca7b604f470 to your computer and use it in GitHub Desktop.
Save grafuls/48eae8ea0ca7b604f470 to your computer and use it in GitHub Desktop.
import csv
with open('wafer.csv', 'r') as f:
reader = csv.reader(f, delimiter=',')
wafer = [row for row in reader]
wafer_set = set([i[1] for i in wafer])
result = []
for n in wafer_set:
result.append([ 0, \
int(n), \
sum([int(i[2]) for i in wafer if i[1] == n and str(i[2]) != '-']), \
sum([1 for i in wafer if i[1] == n and str(i[2]) != '-'])\
])
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment