Report abuse

require 'rubygems'
require 'faster_csv'

category_totals = {}

FCSV.foreach('orig.csv') do |row|
  category_totals[row[0]] ||= 0
  category_totals[row[0]] += row[1]
end

FCSV.open('output.csv','w') do |out|
  category_totals.each do |category,total|
    out << [category,total]
  end
end