class_docstr: Namespace for categorical related series.
class_docstr_tok: ["Namespace","for","categorical","related","series","."]
docstr: Convert a categorical column to its local representation.
  
  This may change the underlying physical representation of the column.
  
  See the documentation of :func:`StringCache` for more information on the
  difference between local and global categoricals.
  
  Examples
  --------
  Compare the global and local representations of a categorical.
  
  >>> with pl.StringCache():
  ...     _ = pl.Series("x", ["a", "b", "a"], dtype=pl.Categorical)
  ...     s = pl.Series("y", ["c", "b", "d"], dtype=pl.Categorical)
  >>> s.to_physical()
  shape: (3,)
  Series: 'y' [u32]
  [
          2
          1
          3
  ]
  >>> s.cat.to_local().to_physical()
  shape: (3,)
  Series: 'y' [u32]
  [
          0
          1
          2
  ]
docstr_tok: ["Convert","a","categorical","column","to","its","local","representation",".","This","may","change","the","underlying","physical","representation","of","the","column",".","See","the","documentation","of",":","func",":","`","StringCache","`","for","more","information","on","the","difference","between","local","and","global","categoricals",".","Examples","--","--","--","--","Compare","the","global","and","local","representations","of","a","categorical",".",">",">",">","with","pl.StringCache","(",")",":","...","_","=","pl.Series","(","``","x","''",",","[","``","a","''",",","``","b","''",",","``","a","''","]",",","dtype=pl.Categorical",")","...","s","=","pl.Series","(","``","y","''",",","[","``","c","''",",","``","b","''",",","``","d","''","]",",","dtype=pl.Categorical",")",">",">",">","s.to_physical","(",")","shape",":","(","3",",",")","Series",":","'","y","'","[","u32","]","[","2","1","3","]",">",">",">","s.cat.to_local","(",")",".to_physical","(",")","shape",":","(","3",",",")","Series",":","'","y","'","[","u32","]","[","0","1","2","]"]
code: def to_local(self) -> Series:
      """
      Convert a categorical column to its local representation.
  
      This may change the underlying physical representation of the column.
  
      See the documentation of :func:`StringCache` for more information on the
      difference between local and global categoricals.
  
      Examples
      --------
      Compare the global and local representations of a categorical.
  
      >>> with pl.StringCache():
      ...     _ = pl.Series("x", ["a", "b", "a"], dtype=pl.Categorical)
      ...     s = pl.Series("y", ["c", "b", "d"], dtype=pl.Categorical)
      >>> s.to_physical()
      shape: (3,)
      Series: 'y' [u32]
      [
              2
              1
              3
      ]
      >>> s.cat.to_local().to_physical()
      shape: (3,)
      Series: 'y' [u32]
      [
              0
              1
              2
      ]
  
      """
      return wrap_s(self._s.cat_to_local())
  
file_path: polars/py-polars/polars/series/categorical.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from polars.series.utils import expr_dispatch
  from polars.utils._wrap import wrap_s
  from polars.utils.deprecation import deprecate_function
label_desc: Use image node_id 5 for calling the CatNameSpace obj's underlying member method code with example usage: obj.to_local() and returns: wrap_s