Sha256: 06eb8ae1bc07e77e0fb8ca6b9f40dc1e24dfc6ce0b3fb8eba1760b6b6e5e0c3f
Contents?: true
Size: 909 Bytes
Versions: 2
Compression:
Stored size: 909 Bytes
Contents
# frozen_string_literal: true module RedAmber # mix-ins for the class DataFrame module DataFrameLoadSave # Enable `self.load` as class method of DataFrame def self.included(klass) klass.extend ClassMethods end # Enable `self.load` as class method of DataFrame module ClassMethods # Load DataFrame via Arrow::Table.load def load(path, options = {}) DataFrame.new(Arrow::Table.load(path, options)) end end # Save DataFrame def save(output, options = {}) @table.save(output, options) end # Save and reload to cast automatically # Via tsv format file temporally as default # # experimental feature def auto_cast(format: :tsv) return self if empty? tempfile = Arrow::ResizableBuffer.new(1024) save(tempfile, format: format) DataFrame.load(tempfile, format: format) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
red_amber-0.2.3 | lib/red_amber/data_frame_loadsave.rb |
red_amber-0.2.2 | lib/red_amber/data_frame_loadsave.rb |