def reindex new_index
      unless new_index.is_a?(Daru::Index)
        raise ArgumentError, 'Must pass the new index of type Index or its '\
          "subclasses, not #{new_index.class}"
      end

      cl = Daru::DataFrame.new({}, order: @vectors, index: new_index, name: @name)
      new_index.each_with_object(cl) do |idx, memo|
        memo.row[idx] = @index.include?(idx) ? row[idx] : [nil]*ncols
      end
    end
def reindex new_index
      unless new_index.is_a?(Daru::Index)
        raise ArgumentError, 'Must pass the new index of type Index or its '\
          "subclasses, not #{new_index.class}"
      end

      cl = Daru::DataFrame.new({}, order: @vectors, index: new_index, name: @name)
      new_index.each_with_object(cl) do |idx, memo|
        memo.row[idx] = @index.include?(idx) ? row[idx] : [nil]*ncols
      end
    end
Change the index of the DataFrame and preserve the labels of the previous
 indexing. New index can be Daru::Index or any of its subclasses.

 @param [Daru::Index] new_index The new Index for reindexing the DataFrame.
 @example Reindexing DataFrame
   df = Daru::DataFrame.new({a: [1,2,3,4], b: [11,22,33,44]},
     index: ['a','b','c','d'])
   #=>
   ##<Daru::DataFrame:83278130 @name = b19277b8-c548-41da-ad9a-2ad8c060e273 @size = 4>
   #                    a          b
   #         a          1         11
   #         b          2         22
   #         c          3         33
   #         d          4         44
   df.reindex Daru::Index.new(['b', 0, 'a', 'g'])
   #=>
   ##<Daru::DataFrame:83177070 @name = b19277b8-c548-41da-ad9a-2ad8c060e273 @size = 4>
   #                    a          b
   #         b          2         22
   #         0        nil        nil
   #         a          1         11
   #         g        nil        nil