Skip to content

Instantly share code, notes, and snippets.

@davo
Created November 13, 2014 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davo/c93532dac5bb54638587 to your computer and use it in GitHub Desktop.
Save davo/c93532dac5bb54638587 to your computer and use it in GitHub Desktop.
Filter columns with Python
import csv
with open("original-large-ass-columns-file.csv","rb") as source:
rdr= csv.reader( source, delimiter=';' )
with open("new-file-lightened.csv","wb") as result:
wtr= csv.writer( result )
for r in rdr:
wtr.writerow((r[2], r[5], r[11]) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment