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



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

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

#[](i) ⇒ Object



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

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

#cast(target_data_type, options: nil) ⇒ Object



113
114
115
# File 'lib/arrow/column.rb', line 113

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

#count(options: nil) ⇒ Object



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

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

#data_typeObject



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

def data_type
  @field.data_type
end

#each(&block) ⇒ Object



65
66
67
# File 'lib/arrow/column.rb', line 65

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

#max(options: nil) ⇒ Object



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

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

#min(options: nil) ⇒ Object



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

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

#n_nullsObject



79
80
81
# File 'lib/arrow/column.rb', line 79

def n_nulls
  @data.n_nulls
end

#nameObject



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

def name
  @field.name
end

#null?(i) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#reverse_each(&block) ⇒ Object



69
70
71
# File 'lib/arrow/column.rb', line 69

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

#sizeObject Also known as: length, n_rows



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

def size
  @data.size
end

#sum(options: nil) ⇒ Object



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

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

#to_arrowObject



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

def to_arrow
  @data
end

#to_arrow_arrayObject



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

def to_arrow_array
  @data.to_arrow_array
end

#to_arrow_chunked_arrayObject



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

def to_arrow_chunked_array
  @data.to_arrow_chunked_array
end

#uniqObject



109
110
111
# File 'lib/arrow/column.rb', line 109

def uniq
  @data.uniq
end

#uniqueObject



105
106
107
# File 'lib/arrow/column.rb', line 105

def unique
  @data.unique
end

#valid?(i) ⇒ Boolean

Returns:

  • (Boolean)


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

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