Method: Daru::Core::Query.vector_where

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

.vector_where(dv, bool_array) ⇒ Object



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

def vector_where dv, bool_array
  new_data, new_index = fetch_new_data_and_index dv, bool_array

  resultant_dv = Daru::Vector.new new_data,
    index: dv.index.class.new(new_index),
    dtype: dv.dtype,
    type: dv.type,
    name: dv.name

  # Preserve categories order for category vector
  resultant_dv.categories = dv.categories if dv.category?
  resultant_dv
end