Python script to extract columns from csv file

1 view
Skip to first unread message

Dilawar Singh

unread,
Aug 5, 2015, 5:30:57 AM8/5/15
to pn...@googlegroups.com
This attached script (also available at
http://github.com/dilawar/Scripts/raw/master/csv_extract_columns.py ) extract
columns from csv files and write them to a new csv file. The use case is pretty
simple.

$ python csv_extract_columns.py -h

To see how to use it.

E.g. If I want to extract all columns from a csv file `input.csv` with names
`time` or `soma` or `apical[32]`, I use it following way

$ python csv_extract_columns.py -in input.csv -c time -c soma -c apical[32]

It will generate new csv file with given columns.

best,
Dilawar
csv_extract_columns.py
Reply all
Reply to author
Forward
0 new messages