Skip to content

Instantly share code, notes, and snippets.

@graingerkid
Created May 5, 2015 16:04
Show Gist options
  • Save graingerkid/e001d30ceffa3d7da8b4 to your computer and use it in GitHub Desktop.
Save graingerkid/e001d30ceffa3d7da8b4 to your computer and use it in GitHub Desktop.
Basic example of working with a CSV file.
# -*- coding: utf-8 -*-
'''
Basic example of working with a CSV file.
'''
import csv
import collections
lis = []
with open("file.csv") as f:
data = csv.reader(f)
for line in data:
lis.append(line[3])
counter = collections.Counter(lis)
for word, value in counter.iteritems():
print word, value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment