Module: DaruLite::DataFrame::Indexable::SetMultiIndexStrategy

Defined in:
lib/daru_lite/data_frame/indexable.rb

Class Method Summary collapse

Class Method Details

.delete_vector(df, cols) ⇒ Object



39
40
41
# File 'lib/daru_lite/data_frame/indexable.rb', line 39

def self.delete_vector(df, cols)
  df.delete_vectors(*cols)
end

.new_index(df, cols) ⇒ Object



33
34
35
36
37
# File 'lib/daru_lite/data_frame/indexable.rb', line 33

def self.new_index(df, cols)
  DaruLite::MultiIndex.from_arrays(df[*cols].map_vectors(&:to_a)).tap do |mi|
    mi.name = cols
  end
end

.uniq_size(df, cols) ⇒ Object



29
30
31
# File 'lib/daru_lite/data_frame/indexable.rb', line 29

def self.uniq_size(df, cols)
  df[*cols].uniq.size
end