Created
January 21, 2015 05:35
-
-
Save bsdlp/3c11b5ddba113d59cbf4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from itertools import tee | |
| def pairwise(iterable): | |
| """ | |
| http://stackoverflow.com/a/11359174 | |
| """ | |
| a, b = tee(iterable) | |
| next(b, None) | |
| return zip(a, b) | |
| with open('top-5K-cleaned.csv', 'w') as fw: | |
| with open('top-5K.csv','r') as fr: | |
| for line, next_line in pairwise(fr): | |
| if line != next_line: | |
| fw.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment