def remove_unused_categories
      old_categories = categories

      initialize_core_attributes to_a
      self.categories = old_categories & categories
      self.base_category = @cat_hash.keys.first unless
        categories.include? base_category
      self
    end
def remove_unused_categories
      old_categories = categories

      initialize_core_attributes to_a
      self.categories = old_categories & categories
      self.base_category = @cat_hash.keys.first unless
        categories.include? base_category
      self
    end
Removes the unused categories
 @note If base category is removed, then the first occuring category in the
   data is taken as base category. Order of the undeleted categories
   remains preserved.
 @return [Daru::Vector] Makes changes in the vector itself i.e. deletes
   the unused categories and returns itself
 @example
   dv = Daru::Vector.new [:one, :two, :one], type: :category,
     categories: [:three, :two, :one]
   dv.remove_unused_categories
   dv.categories
   # => [:two, :one]