I want to load a CSV-file with two columns (each with a name and a row of numbers) and save only the numbers of the two columns in two different arrays. Then I want to make some calculations with the data in those two columns, using two arrays to save the numbers of each column.
This is what I still have:
require 'csv'
filename = 'file.csv'
csv_data = CSV.read(filename, :col_sep => ";")
csv_data.shift
csv_data.each_with_index { |column, index_c|
average = 0
column.each_with_index{ |element, index_e|
csv_data[index_c][index_e] = element.to_i
}
}
csv_data = csv_data.transpose
How can I split the columns of csv_data in two arrays ?