Module: RedAmber::DataFrameLoadSave

Included in:
DataFrame
Defined in:
lib/red_amber/data_frame_loadsave.rb

Overview

mix-ins for the class DataFrame

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Enable ‘self.load` as class method of DataFrame



7
8
9
# File 'lib/red_amber/data_frame_loadsave.rb', line 7

def self.included(klass)
  klass.extend ClassMethods
end

Instance Method Details

#auto_cast(format: :tsv) ⇒ Object

Note:

experimental feature

Save and reload to cast automatically

Via tsv format file temporally as default


31
32
33
34
35
36
37
# File 'lib/red_amber/data_frame_loadsave.rb', line 31

def auto_cast(format: :tsv)
  return self if empty?

  tempfile = Arrow::ResizableBuffer.new(1024)
  save(tempfile, format: format)
  DataFrame.load(tempfile, format: format)
end

#save(output, options = {}) ⇒ DataFrame

Save DataFrame

Returns:



22
23
24
25
# File 'lib/red_amber/data_frame_loadsave.rb', line 22

def save(output, options = {})
  @table.save(output, options)
  self
end