import csv
with open('thefile.csv', 'rb') as f:
data = list(csv.reader(f))
import collections
counter = collections.defaultdict(int)
for row in data:
counter[row[10]] += 1
with open('/pythonwork/thefile_subset11.csv', 'w') as outfile:
writer = csv.writer(outfile)
sample_cutoff=500
b[]
for row in data:
if counter[row[10]] >= sample_cutoff:
writer.writerow(row)
in addition to writing the data to a file, i would like to insert it into a list b[]
can i just do b.insert[row]
?