Class: Arrow::Column

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/arrow/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container, index) ⇒ Column

Returns a new instance of Column.



25
26
27
28
29
30
31
# File 'lib/arrow/column.rb', line 25

def initialize(container, index)
  @container = container
  @index = index
  @field = @container.schema[@index]
  @data = @container.get_column_data(@index)
  @container.share_input(@data)
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



22
23
24
# File 'lib/arrow/column.rb', line 22

def container
  @container
end

#dataObject (readonly)

Returns the value of attribute data.



24
25
26
# File 'lib/arrow/column.rb', line 24

def data
  @data
end

#fieldObject (readonly)

Returns the value of attribute field.



23
24
25
# File 'lib/arrow/column.rb', line 23

def field
  @field
end

Instance Method Details

#==(other) ⇒ Object



71
72
73
74
75
# File 'lib/arrow/column.rb', line 71

def ==(other)
  other.is_a?(self.class) and
    @field == other.field and
    @data == other.data
end

#[](i) ⇒ Object



49
50
51
# File 'lib/arrow/column.rb', line 49

def [](i)
  @data[i]
end

#cast(target_data_type, options: nil) ⇒ Object



101
102
103
# File 'lib/arrow/column.rb', line 101

def cast(target_data_type, options: nil)
  @data.cast(target_data_type, options: options)
end

#count(options: nil) ⇒ Object



77
78
79
# File 'lib/arrow/column.rb', line 77

def count(options: nil)
  @data.count(options: options)
end

#data_typeObject



37
38
39
# File 'lib/arrow/column.rb', line 37

def data_type
  @field.data_type
end

#each(&block) ⇒ Object



53
54
55
# File 'lib/arrow/column.rb', line 53

def each(&block)
  @data.each(&block)
end

#max(options: nil) ⇒ Object



89
90
91
# File 'lib/arrow/column.rb', line 89

def max(options: nil)
  @data.max(options: options)
end

#min(options: nil) ⇒ Object



85
86
87
# File 'lib/arrow/column.rb', line 85

def min(options: nil)
  @data.min(options: options)
end

#n_nullsObject



67
68
69
# File 'lib/arrow/column.rb', line 67

def n_nulls
  @data.n_nulls
end

#n_rowsObject Also known as: size, length



61
62
63
# File 'lib/arrow/column.rb', line 61

def n_rows
  @data.n_rows
end

#nameObject



33
34
35
# File 'lib/arrow/column.rb', line 33

def name
  @field.name
end

#null?(i) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/arrow/column.rb', line 41

def null?(i)
  @data.null?(i)
end

#reverse_each(&block) ⇒ Object



57
58
59
# File 'lib/arrow/column.rb', line 57

def reverse_each(&block)
  @data.reverse_each(&block)
end

#sum(options: nil) ⇒ Object



81
82
83
# File 'lib/arrow/column.rb', line 81

def sum(options: nil)
  @data.sum(options: options)
end

#uniqObject



97
98
99
# File 'lib/arrow/column.rb', line 97

def uniq
  @data.uniq
end

#uniqueObject



93
94
95
# File 'lib/arrow/column.rb', line 93

def unique
  @data.unique
end

#valid?(i) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/arrow/column.rb', line 45

def valid?(i)
  @data.valid?(i)
end