def vectors= new_index
      unless new_index.is_a?(Daru::Index)
        raise ArgumentError, 'Can only reindex with Index and its subclasses'
      end

      if new_index.size != ncols
        raise ArgumentError, "Specified index length #{new_index.size} not equal to"\
          "dataframe size #{ncols}"
      end

      @vectors = new_index
      @data.zip(new_index.to_a).each do |vect, name|
        vect.name = name
      end
      self
    end
def vectors= new_index
      unless new_index.is_a?(Daru::Index)
        raise ArgumentError, 'Can only reindex with Index and its subclasses'
      end

      if new_index.size != ncols
        raise ArgumentError, "Specified index length #{new_index.size} not equal to"\
          "dataframe size #{ncols}"
      end

      @vectors = new_index
      @data.zip(new_index.to_a).each do |vect, name|
        vect.name = name
      end
      self
    end
Reassign vectors with a new index of type Daru::Index or any of its subclasses.

 @param new_index [Daru::Index] idx The new index object on which the vectors are to
   be indexed. Must of the same size as ncols.
 @example Reassigning vectors of a DataFrame
   df = Daru::DataFrame.new({a: [1,2,3,4], b: [:a,:b,:c,:d], c: [11,22,33,44]})
   df.vectors.to_a #=> [:a, :b, :c]

   df.vectors = Daru::Index.new([:foo, :bar, :baz])
   df.vectors.to_a #=> [:foo, :bar, :baz]