def split_by_category cat_name
      cat_dv = self[cat_name]
      raise ArgumentError, "#{cat_name} is not a category vector" unless
        cat_dv.category?

      cat_dv.categories.map do |cat|
        where(cat_dv.eq cat)
          .rename(cat)
          .delete_vector cat_name
      end
    end
def split_by_category cat_name
      cat_dv = self[cat_name]
      raise ArgumentError, "#{cat_name} is not a category vector" unless
        cat_dv.category?

      cat_dv.categories.map do |cat|
        where(cat_dv.eq cat)
          .rename(cat)
          .delete_vector cat_name
      end
    end
Split the dataframe into many dataframes based on category vector
 @param [object] cat_name name of category vector to split the dataframe
 @return [Array] array of dataframes split by category with category vector
   used to split not included
 @example
   df = Daru::DataFrame.new({
     a: [1, 2, 3],
     b: ['a', 'a', 'b']
   })
   df.to_category :b
   df.split_by_category :b
   # => [#<Daru::DataFrame: a (2x1)>
   #       a
   #   0   1
   #   1   2,
   # #<Daru::DataFrame: b (1x1)>
   #       a
   #   2   3]