parameters: (self, categories, fastpath=False)
docstring: Sets new categories inplace
  
          Parameters
          ----------
          fastpath : bool, default False
             Don't perform validation of the categories for uniqueness or nulls
  
          Examples
          --------
          >>> c = pd.Categorical(['a', 'b'])
          >>> c
          [a, b]
          Categories (2, object): [a, b]
  
          >>> c._set_categories(pd.Index(['a', 'c']))
          >>> c
          [a, c]
          Categories (2, object): [a, c]
docstring_summary: Sets new categories inplace
docstring_tokens: Sets new categories inplace
function: def _set_categories(self, categories, fastpath=False):
          """
          Sets new categories inplace
  
          Parameters
          ----------
          fastpath : bool, default False
             Don't perform validation of the categories for uniqueness or nulls
  
          Examples
          --------
          >>> c = pd.Categorical(['a', 'b'])
          >>> c
          [a, b]
          Categories (2, object): [a, b]
  
          >>> c._set_categories(pd.Index(['a', 'c']))
          >>> c
          [a, c]
          Categories (2, object): [a, c]
          """
  
          if fastpath:
              new_dtype = CategoricalDtype._from_fastpath(categories, self.ordered)
          else:
              new_dtype = CategoricalDtype(categories, ordered=self.ordered)
          if (
              not fastpath
              and self.dtype.categories is not None
              and len(new_dtype.categories) != len(self.dtype.categories)
          ):
              raise ValueError(
                  "new categories need to have the same number of "
                  "items than the old categories!"
              )
  
          self._dtype = new_dtype
function_tokens: def _set_categories ( self , categories , fastpath = False ) : if fastpath : new_dtype = CategoricalDtype . _from_fastpath ( categories , self . ordered ) else : new_dtype = CategoricalDtype ( categories , ordered = self . ordered ) if ( not fastpath and self . dtype . categories is not None and len ( new_dtype . categories ) != len ( self . dtype . categories ) ) : raise ValueError ( "new categories need to have the same number of " "items than the old categories!" ) self . _dtype = new_dtype