class_docstr: Parameters
  ----------
  data : mapping
      Mapping of keys to column values.
  multiindex : bool, optional
      Whether tuple keys represent a hierarchical
      index with multiple "levels" (default=False).
  level_names : tuple, optional
      Tuple containing names for each of the levels.
      For a non-hierarchical index, a tuple of size 1
      may be passe.
  rangeindex : bool, optional
      Whether the keys should be returned as a RangeIndex
      in `to_pandas_index` (default=False).
  label_dtype : Dtype, optional
      What dtype should be returned in `to_pandas_index`
      (default=None).
class_docstr_tok: ["Parameters","--","--","--","--","--","data",":","mapping","Mapping","of","keys","to","column","values",".","multiindex",":","bool",",","optional","Whether","tuple","keys","represent","a","hierarchical","index","with","multiple","``","levels","''","(","default=False",")",".","level_names",":","tuple",",","optional","Tuple","containing","names","for","each","of","the","levels",".","For","a","non-hierarchical","index",",","a","tuple","of","size","1","may","be","passe",".","rangeindex",":","bool",",","optional","Whether","the","keys","should","be","returned","as","a","RangeIndex","in","`","to_pandas_index","`","(","default=False",")",".","label_dtype",":","Dtype",",","optional","What","dtype","should","be","returned","in","`","to_pandas_index","`","(","default=None",")","."]
docstr: Rename the specified levels of the given ColumnAccessor
  
  Parameters
  ----------
  self : ColumnAccessor of a given dataframe
  
  mapper : dict-like or function transformations to apply to
      the column label values depending on selected ``level``.
  
      If dict-like, only replace the specified level of the
      ColumnAccessor's keys (that match the mapper's keys) with
      mapper's values
  
      If callable, the function is applied only to the specified level
      of the ColumnAccessor's keys.
  
  level : int
      In case of RangeIndex, only supported level is [0, None].
      In case of a MultiColumn, only the column labels in the specified
      level of the ColumnAccessor's keys will be transformed.
  
  Returns
  -------
  A new ColumnAccessor with values in the keys replaced according
  to the given mapper and level.
docstr_tok: ["Rename","the","specified","levels","of","the","given","ColumnAccessor","Parameters","--","--","--","--","--","self",":","ColumnAccessor","of","a","given","dataframe","mapper",":","dict-like","or","function","transformations","to","apply","to","the","column","label","values","depending","on","selected","``","level","``",".","If","dict-like",",","only","replace","the","specified","level","of","the","ColumnAccessor","'s","keys","(","that","match","the","mapper","'s","keys",")","with","mapper","'s","values","If","callable",",","the","function","is","applied","only","to","the","specified","level","of","the","ColumnAccessor","'s","keys",".","level",":","int","In","case","of","RangeIndex",",","only","supported","level","is","[","0",",","None","]",".","In","case","of","a","MultiColumn",",","only","the","column","labels","in","the","specified","level","of","the","ColumnAccessor","'s","keys","will","be","transformed",".","Returns","--","--","--","-","A","new","ColumnAccessor","with","values","in","the","keys","replaced","according","to","the","given","mapper","and","level","."]
code: def rename_levels(
      self,
      mapper: Union[Mapping[Any, Any], Callable],
      level: Optional[int],
  ) -> ColumnAccessor:
      """
      Rename the specified levels of the given ColumnAccessor
  
      Parameters
      ----------
      self : ColumnAccessor of a given dataframe
  
      mapper : dict-like or function transformations to apply to
          the column label values depending on selected ``level``.
  
          If dict-like, only replace the specified level of the
          ColumnAccessor's keys (that match the mapper's keys) with
          mapper's values
  
          If callable, the function is applied only to the specified level
          of the ColumnAccessor's keys.
  
      level : int
          In case of RangeIndex, only supported level is [0, None].
          In case of a MultiColumn, only the column labels in the specified
          level of the ColumnAccessor's keys will be transformed.
  
      Returns
      -------
      A new ColumnAccessor with values in the keys replaced according
      to the given mapper and level.
  
      """
      if self.multiindex:
  
          def rename_column(x):
              x = list(x)
              if isinstance(mapper, Mapping):
                  x[level] = mapper.get(x[level], x[level])
              else:
                  x[level] = mapper(x[level])
              x = tuple(x)
              return x
  
          if level is None:
              raise NotImplementedError(
                  "Renaming columns with a MultiIndex and level=None is"
                  "not supported"
              )
          new_names = map(rename_column, self.keys())
          ca = ColumnAccessor(
              dict(zip(new_names, self.values())),
              level_names=self.level_names,
              multiindex=self.multiindex,
          )
  
      else:
          if level is None:
              level = 0
          if level != 0:
              raise IndexError(
                  f"Too many levels: Index has only 1 level, not {level+1}"
              )
  
          if isinstance(mapper, Mapping):
              new_col_names = [
                  mapper.get(col_name, col_name)
                  for col_name in self.keys()
              ]
          else:
              new_col_names = [
                  mapper(col_name) for col_name in self.keys()
              ]
  
          if len(new_col_names) != len(set(new_col_names)):
              raise ValueError("Duplicate column names are not allowed")
  
          ca = ColumnAccessor(
              dict(zip(new_col_names, self.values())),
              level_names=self.level_names,
              multiindex=self.multiindex,
          )
  
      return self.__class__(ca)
  
imports: from __future__ import annotations
  import itertools
  import warnings
  from collections import abc
  from functools import cached_property, reduce
  from typing import TYPE_CHECKING, Any, Callable, Dict, Mapping, Optional, Tuple, Union
  import numpy
  import pandas
  from packaging.version import Version
  from pandas.api.types import is_bool
  from typing_extensions import Self
  import cudf
  from cudf.core import column
label_desc: Use image node_id 32 for calling the ColumnAccessor obj's underlying member method code with example usage: obj.rename_levels(mapper, level) and returns: self, x