Sha256: 226cc9b9151c88af5131a5cdaa641c2dd14db35f0aba8448395c3679c46fd174
Contents?: true
Size: 643 Bytes
Versions: 1
Compression:
Stored size: 643 Bytes
Contents
module Daru module IO class << self def from_csv path, opts={} opts[:col_sep] ||= ',' opts[:headers] ||= true opts[:converters] ||= :numeric opts[:header_converters] ||= :symbol csv = CSV.open(path, 'r', opts) yield csv if block_given? first = true df = nil csv.each_with_index do |row, index| if first df = Daru::DataFrame.new({}, order: csv.headers, name: opts[:name]) first = false end df.row[index] = row.fields end df end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
daru-0.0.4 | lib/daru/io/io.rb |