Last change
on this file since 6439 was
6439,
checked in by jgriffin, 14 years ago
|
file to read csv and extract wanted columns
|
File size:
737 bytes
|
Line | |
---|
1 | """Script to read large csv files (larger than can be read in Excel) |
---|
2 | and extract the wanted columns |
---|
3 | """ |
---|
4 | |
---|
5 | import csv |
---|
6 | ##input csv |
---|
7 | reader = csv.reader(open("/nas/gemd/georisk_models/inundation/data/new_south_wales/batemans_bay_tsunami_scenario_2009/elevation_final/points/SD100031996_batemans_mga_clip_jgriffin_clip.csv", "r")) |
---|
8 | ##new csv to write desired columns to |
---|
9 | writer = csv.writer(open("/nas/gemd/georisk_models/inundation/data/new_south_wales/batemans_bay_tsunami_scenario_2009/elevation_final/points/SD100031996_batemans_mga_clip_jgriffin_clip_written.csv","w")) |
---|
10 | |
---|
11 | #enter the column number for desired columns (remember to start couting from 0 in python) |
---|
12 | for row in reader: |
---|
13 | writer.writerow((row[2], row[3],row[4])) |
---|
14 | |
---|
Note: See
TracBrowser
for help on using the repository browser.