Dear Community,
I am struggling with a small problem with FasterCSV. This is a sample
line from a CSV:
14;"0810065750";"2500";"Baiki";;1/21/2011;Notime;08:30;17:30;08:17;20:35;1;1;;;;3:05:41
AM;09:00;;Y;Y;1;;;12:18;3.09;;
Now, this is the code I use to read the file:
csv_data = FCSV.table(input_file, :col_sep => ';', :skip_blanks => true)
employees_id = csv_data[:emp_no].uniq
employees_id.each do |id|
employees_records_tmp = csv_data.select { |row| row[:emp_no] == id
}.map { |row| row.to_hash }
employees_records = employees_records_tmp.sort_by { |row|
Date.strptime(row[:date], "%m/%d/%Y") }
puts employees_records[0][:acno]
puts employees_records[0][:acno].class
And the output:
810065750.0
Float
How can I instruct FasterCSV (FCSV) no to convert this particular
column? Because output should be equal input, no changes. Or should I
try to convert all?
Best regards,
Baiki
···
--
Posted via http://www.ruby-forum.com/.