class_docstr: Accessor object for categorical properties of the Series values.
  
  Examples
  --------
  >>> s = ps.Series(list("abbccc"), dtype="category")
  >>> s  # doctest: +SKIP
  0    a
  1    b
  2    b
  3    c
  4    c
  5    c
  dtype: category
  Categories (3, object): ['a', 'b', 'c']
  
  >>> s.cat.categories
  Index(['a', 'b', 'c'], dtype='object')
  
  >>> s.cat.codes
  0    0
  1    1
  2    1
  3    2
  4    2
  5    2
  dtype: int8
class_docstr_tok: ["Accessor","object","for","categorical","properties","of","the","Series","values",".","Examples","--","--","--","--",">",">",">","s","=","ps.Series","(","list","(","``","abbccc","''",")",",","dtype=","''","category","''",")",">",">",">","s","#","doctest",":","+SKIP","0","a","1","b","2","b","3","c","4","c","5","c","dtype",":","category","Categories","(","3",",","object",")",":","[","'","a","'",",","'","b","'",",","'","c","'","]",">",">",">","s.cat.categories","Index","(","[","'","a","'",",","'","b","'",",","'","c","'","]",",","dtype='object","'",")",">",">",">","s.cat.codes","0","0","1","1","2","1","3","2","4","2","5","2","dtype",":","int8"]
docstr: Remove the specified categories.
  
  `removals` must be included in the old categories. Values which were in
  the removed categories will be set to NaN
  
  Parameters
  ----------
  removals : category or list of categories
     The categories which should be removed.
  
  Returns
  -------
  Series
      Categorical with removed categories
  
  Raises
  ------
  ValueError
      If the removals are not contained in the categories
  
  See Also
  --------
  rename_categories : Rename categories.
  reorder_categories : Reorder categories.
  add_categories : Add new categories.
  remove_unused_categories : Remove categories which are not used.
  set_categories : Set the categories to the specified ones.
  
  Examples
  --------
  >>> s = ps.Series(list("abbccc"), dtype="category")
  >>> s  # doctest: +SKIP
  0    a
  1    b
  2    b
  3    c
  4    c
  5    c
  dtype: category
  Categories (3, object): ['a', 'b', 'c']
  
  >>> s.cat.remove_categories('b')  # doctest: +SKIP
  0      a
  1    NaN
  2    NaN
  3      c
  4      c
  5      c
  dtype: category
  Categories (2, object): ['a', 'c']
docstr_tok: ["Remove","the","specified","categories",".","`","removals","`","must","be","included","in","the","old","categories",".","Values","which","were","in","the","removed","categories","will","be","set","to","NaN","Parameters","--","--","--","--","--","removals",":","category","or","list","of","categories","The","categories","which","should","be","removed",".","Returns","--","--","--","-","Series","Categorical","with","removed","categories","Raises","--","--","--","ValueError","If","the","removals","are","not","contained","in","the","categories","See","Also","--","--","--","--","rename_categories",":","Rename","categories",".","reorder_categories",":","Reorder","categories",".","add_categories",":","Add","new","categories",".","remove_unused_categories",":","Remove","categories","which","are","not","used",".","set_categories",":","Set","the","categories","to","the","specified","ones",".","Examples","--","--","--","--",">",">",">","s","=","ps.Series","(","list","(","``","abbccc","''",")",",","dtype=","''","category","''",")",">",">",">","s","#","doctest",":","+SKIP","0","a","1","b","2","b","3","c","4","c","5","c","dtype",":","category","Categories","(","3",",","object",")",":","[","'","a","'",",","'","b","'",",","'","c","'","]",">",">",">","s.cat.remove_categories","(","'","b","'",")","#","doctest",":","+SKIP","0","a","1","NaN","2","NaN","3","c","4","c","5","c","dtype",":","category","Categories","(","2",",","object",")",":","[","'","a","'",",","'","c","'","]"]
code: def remove_categories(
      self, removals: Union[pd.Index, Any, List]
  ) -> Optional["ps.Series"]:
      """
      Remove the specified categories.
  
      `removals` must be included in the old categories. Values which were in
      the removed categories will be set to NaN
  
      Parameters
      ----------
      removals : category or list of categories
         The categories which should be removed.
  
      Returns
      -------
      Series
          Categorical with removed categories
  
      Raises
      ------
      ValueError
          If the removals are not contained in the categories
  
      See Also
      --------
      rename_categories : Rename categories.
      reorder_categories : Reorder categories.
      add_categories : Add new categories.
      remove_unused_categories : Remove categories which are not used.
      set_categories : Set the categories to the specified ones.
  
      Examples
      --------
      >>> s = ps.Series(list("abbccc"), dtype="category")
      >>> s  # doctest: +SKIP
      0    a
      1    b
      2    b
      3    c
      4    c
      5    c
      dtype: category
      Categories (3, object): ['a', 'b', 'c']
  
      >>> s.cat.remove_categories('b')  # doctest: +SKIP
      0      a
      1    NaN
      2    NaN
      3      c
      4      c
      5      c
      dtype: category
      Categories (2, object): ['a', 'c']
      """
      categories: List[Any]
      if is_list_like(removals):
          categories = [cat for cat in removals if cat is not None]
      elif removals is None:
          categories = []
      else:
          categories = [removals]
  
      if any(cat not in self.categories for cat in categories):
          raise ValueError(
              "removals must all be in old categories: {{{cats}}}".format(
                  cats=", ".join(
                      set(
                          str(cat)
                          for cat in categories
                          if cat not in self.categories
                      )
                  )
              )
          )
  
      if len(categories) == 0:
          return self._data.copy()
      else:
          data = [
              cat
              for cat in self.categories.sort_values()
              if cat not in categories
          ]
          if len(data) == 0:
              # We should keep original dtype when even removing all categories.
              data = pd.Index(data, dtype=self.categories.dtype)  # type: ignore[assignment]
          dtype = CategoricalDtype(
              categories=data,
              ordered=self.ordered,
          )
          return self._data.astype(dtype)
  
imports: from typing import Any, Callable, List, Optional, Union, TYPE_CHECKING, cast
  import pandas
  from pandas.api.types import CategoricalDtype, is_dict_like, is_list_like
  from pyspark.pandas.internal import InternalField
  from pyspark.pandas.data_type_ops.categorical_ops import _to_cat
  from pyspark.sql import functions
  from pyspark.sql.types import StructField
label_desc: Use image node_id 11 for calling the CategoricalAccessor obj's underlying member method code with example usage: obj.remove_categories(removals) and returns: self, self