Skip to content

Instantly share code, notes, and snippets.

@fegoa89
Created May 12, 2015 10:26
Show Gist options
  • Save fegoa89/ea8915ebaabb71c9e0c2 to your computer and use it in GitHub Desktop.
Save fegoa89/ea8915ebaabb71c9e0c2 to your computer and use it in GitHub Desktop.
Create a new CSV without duplicated rows in Python
# python -t format_duplicated_rows.py
with open('input.csv','r') as in_file, open('output.csv','w') as out_file:
seen = set()
for line in in_file:
if (line in seen):
continue
else:
seen.add(line)
out_file.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment