Class: Remi::Extractor::DataFrame

Inherits:
Remi::Extractor show all
Defined in:
lib/remi/data_subjects/data_frame.rb

Overview

DataFrame extractor. This class is used to hard-code a dataframe as a simple array of rows.

Examples:


class MyJob < Remi::Job
  source :my_df do
    fields ({ id: {}, name: {}})
    extractor Remi::Extractor::DataFrame.new(
      data: [
        [1, 'Albert'],
        [2, 'Betsy'],
        [3, 'Camu']
      ]
    )
    parser Remi::Parser::DataFrame.new
  end
end

job = MyJob.new
job.my_df.df.inspect
# =>#<Daru::DataFrame:70153153438500 @name = 4c59cfdd-7de7-4264-8666-83153f46a9e4 @size = 3>
#                    id       name
#          0          1     Albert
#          1          2      Betsy
#          2          3       Camu

Instance Attribute Summary collapse

Attributes inherited from Remi::Extractor

#logger

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kargs, &block) ⇒ DataFrame

Returns a new instance of DataFrame.

Parameters:

  • data (Array<Array>)

    An array of arrays representing rows of a dataframe.



32
33
34
35
# File 'lib/remi/data_subjects/data_frame.rb', line 32

def initialize(*args, **kargs, &block)
  super
  init_data_frame_extractor(*args, **kargs, &block)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



37
38
39
# File 'lib/remi/data_subjects/data_frame.rb', line 37

def data
  @data
end

Instance Method Details

#extractObject

Returns self.

Returns:

  • (Object)

    self



40
41
42
# File 'lib/remi/data_subjects/data_frame.rb', line 40

def extract
  self
end