class Charty::Index
Attributes
name[RW]
values[R]
Public Class Methods
new(values, name: nil)
click to toggle source
# File lib/charty/index.rb, line 8 def initialize(values, name: nil) @values = values @name = name end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
# File lib/charty/index.rb, line 18 def ==(other) case other when DaruIndex, PandasIndex return false if length != other.length to_a == other.to_a when Index return false if length != other.length return true if values == other.values to_a == other.to_a else super end end
[](i)
click to toggle source
# File lib/charty/index.rb, line 32 def [](i) case i when 0 ... length values[i] else raise IndexError, "index out of range" end end
loc(key)
click to toggle source
# File lib/charty/index.rb, line 41 def loc(key) values.index(key) end
union(other)
click to toggle source
# File lib/charty/index.rb, line 45 def union(other) case other when PandasIndex index = PandasIndex.try_convert(self) return index.union(other) if index end Index.new(to_a.union(other.to_a), name: name) end