Class: Remi::DataSource::DataFrame

Inherits:
Remi::DataSource show all
Defined in:
lib/remi/data_subject/data_frame.rb

Instance Attribute Summary

Attributes inherited from Remi::DataSubject

#fields

Instance Method Summary collapse

Methods inherited from Remi::DataSource

#df, #extract

Methods included from Testing::DataStub

#empty_stub_df, #stub_boolean, #stub_date, #stub_datetime, #stub_decimal, #stub_df, #stub_float, #stub_integer, #stub_json, #stub_row_array, #stub_string, #stub_values

Methods inherited from Remi::DataSubject

#df, #df=, #enforce_types, #field_symbolizer

Constructor Details

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

Returns a new instance of DataFrame.



5
6
7
8
# File 'lib/remi/data_subject/data_frame.rb', line 5

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

Instance Method Details

#extract!Object

Public: Called to extract data from the source.

Returns data in a format that can be used to create a dataframe.



13
14
15
# File 'lib/remi/data_subject/data_frame.rb', line 13

def extract!
  @extract = @data.transpose
end

#to_dataframeObject

Public: Converts extracted data to a dataframe

Returns a Remi::DataFrame



20
21
22
# File 'lib/remi/data_subject/data_frame.rb', line 20

def to_dataframe
  DataFrame.create(@remi_df_type, extract, order: @fields.keys)
end