Module: DF::Import::InstanceMethods

Includes:
InferCSV
Included in:
DataFrame
Defined in:
lib/data_frame/core/import.rb

Overview

Class Methods

Instance Method Summary collapse

Instance Method Details

#add_item(item) ⇒ Object Also known as: add



69
70
71
# File 'lib/data_frame/core/import.rb', line 69

def add_item(item)
  self.items << item
end

#import(rows) ⇒ Object

Loads a batch of rows. Expects an array of arrays, else you don’t know what you have.



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/data_frame/core/import.rb', line 76

def import(rows)
  case rows
  when Array
    import_array(rows)
  when String
    labels, table = infer_csv_contents(rows, :headers => false)
    import(table)
  else
    raise ArgumentError, "Don't know how to import data from #{rows.class}"
  end
  true
end