On Feb 5, 11:44 pm, Gary <gb3... / excite.com> wrote: > Hi. I want to add a normalized column to a csv file. That is, I want to > read the file, sum all of a column X, then add another column in which > each X is divided by the sum. So do I use the CSV rows twice without > reading the file twice? ...snip... csvData = FasterCSV.read('/path/to/infile.csv', :headers=>true) ## read all data into an array of FasterCSV::Rows ##, may run into memory issues sumColX = 0 csvData.each{|row| sum += row['ColX']} FasterCSV.open("path/to/outfile.csv", "w") do |csv| csvData.each{ |row| csv << row << row['ColX'].to_f / sum ## calc and append norm value and output row of CSV DATA } end Not tested, or even executed but I think its close 9^) Cheers Chris