Hit post by accident! The full final example:
header_row = "year,month,day,price\n"
index_of = header_row.chomp.split(',').to_h.invert
# => {"month"=>1, "price"=>3, "day"=>2, "year"=>0}
data_row = "2002,1,17,1.5\n"
cells = data_row.chomp.split(',')
cells[index_of['year']]
# => "2002"
Cheers,
Tom