Skip to content

Instantly share code, notes, and snippets.

@jlogsdon
Created March 5, 2012 20:47
Show Gist options
  • Select an option

  • Save jlogsdon/1980978 to your computer and use it in GitHub Desktop.

Select an option

Save jlogsdon/1980978 to your computer and use it in GitHub Desktop.
require 'csv'
headers = []
data = []
CSV.foreach('tapjoyserver/tapjoyads/test.csv') do |row|
if headers.empty?
headers = row
else
data << Hash[headers.map { |h| [h, row.shift] }]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment