def reindex! new_index
      values = []
      each_with_index do |val, i|
        values[new_index[i]] = val if new_index.include?(i)
      end
      values.fill(nil, values.size, new_index.size - values.size)

      @data = cast_vector_to @dtype, values
      @index = new_index

      update_position_cache

      self
    end
def reindex! new_index
      values = []
      each_with_index do |val, i|
        values[new_index[i]] = val if new_index.include?(i)
      end
      values.fill(nil, values.size, new_index.size - values.size)

      @data = cast_vector_to @dtype, values
      @index = new_index

      update_position_cache

      self
    end
Sets new index for vector. Preserves index->value correspondence.
 Sets nil for new index keys absent from original index.
 @note Unlike #reorder! which takes positions as input it takes
   index as an input to reorder the vector
 @param [Daru::Index, Daru::MultiIndex] new_index new index to order with
 @return [Daru::Vector] vector reindexed with new index