Skip to content

Instantly share code, notes, and snippets.

@mrocklin
Last active January 2, 2016 21:49
Show Gist options
  • Save mrocklin/8365524 to your computer and use it in GitHub Desktop.
Save mrocklin/8365524 to your computer and use it in GitHub Desktop.
from toolz import groupby, first
from sys import argv
filename = argv[1]
with duration():
file = open(filename)
lines = map(str.strip, file)
word_pairs = map(lambda s: s.split(','), lines)
result = groupby(first, word_pairs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment