Method: Daru::Core::Query.vector_where

Defined in:
lib/daru/core/query.rb

.vector_where(data, index, bool_array, dtype) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/daru/core/query.rb', line 59

def vector_where data, index, bool_array, dtype
  new_data = []
  new_index = []
  bool_array.to_a.each_with_index do |b, i|
    if b
      new_data << data[i]
      new_index << index[i]
    end
  end

  Daru::Vector.new(new_data, index: new_index, dtype: dtype)
end