Module: Daru::DataFrame::SetMultiIndexStrategy

Defined in:
lib/daru/dataframe.rb

Class Method Summary collapse

Class Method Details

.delete_vector(df, cols) ⇒ Object



1575
1576
1577
# File 'lib/daru/dataframe.rb', line 1575

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

.new_index(df, cols) ⇒ Object



1568
1569
1570
1571
1572
1573
# File 'lib/daru/dataframe.rb', line 1568

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

.uniq_size(df, cols) ⇒ Object



1564
1565
1566
# File 'lib/daru/dataframe.rb', line 1564

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