@rewrite_axis_style_signature('<STR_LIT>', [('<STR_LIT>', True),<EOL>('<STR_LIT>', False)])<EOL><INDENT>def rename_axis(self, mapper=sentinel, **kwargs):<DEDENT>
axes, kwargs = self._construct_axes_from_arguments(<EOL>(), kwargs, sentinel=sentinel)<EOL>copy = kwargs.pop('<STR_LIT>', True)<EOL>inplace = kwargs.pop('<STR_LIT>', False)<EOL>axis = kwargs.pop('<STR_LIT>', <NUM_LIT:0>)<EOL>if axis is not None:<EOL><INDENT>axis = self._get_axis_number(axis)<EOL><DEDENT>if kwargs:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'.format(list(kwargs.keys())[<NUM_LIT:0>]))<EOL><DEDENT>inplace = validate_bool_kwarg(inplace, '<STR_LIT>')<EOL>if (mapper is not sentinel):<EOL><INDENT>non_mapper = is_scalar(mapper) or (is_list_like(mapper) and not<EOL>is_dict_like(mapper))<EOL>if non_mapper:<EOL><INDENT>return self._set_axis_name(mapper, axis=axis, inplace=inplace)<EOL><DEDENT>else:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>warnings.warn(msg, FutureWarning, stacklevel=<NUM_LIT:3>)<EOL>axis = self._get_axis_name(axis)<EOL>d = {'<STR_LIT>': copy, '<STR_LIT>': inplace}<EOL>d[axis] = mapper<EOL>return self.rename(**d)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result = self if inplace else self.copy(deep=copy)<EOL>for axis in lrange(self._AXIS_LEN):<EOL><INDENT>v = axes.get(self._AXIS_NAMES[axis])<EOL>if v is sentinel:<EOL><INDENT>continue<EOL><DEDENT>non_mapper = is_scalar(v) or (is_list_like(v) and not<EOL>is_dict_like(v))<EOL>if non_mapper:<EOL><INDENT>newnames = v<EOL><DEDENT>else:<EOL><INDENT>f = com._get_rename_function(v)<EOL>curnames = self._get_axis(axis).names<EOL>newnames = [f(name) for name in curnames]<EOL><DEDENT>result._set_axis_name(newnames, axis=axis,<EOL>inplace=True)<EOL><DEDENT>if not inplace:<EOL><INDENT>return result<EOL><DEDENT><DEDENT>
Set the name of the axis for the index or columns.

Parameters
----------
mapper : scalar, list-like, optional
    Value to set the axis name attribute.
index, columns : scalar, list-like, dict-like or function, optional
    A scalar, list-like, dict-like or functions transformations to
    apply to that axis' values.

    Use either ``mapper`` and ``axis`` to
    specify the axis to target with ``mapper``, or ``index``
    and/or ``columns``.

    .. versionchanged:: 0.24.0

axis : {0 or 'index', 1 or 'columns'}, default 0
    The axis to rename.
copy : bool, default True
    Also copy underlying data.
inplace : bool, default False
    Modifies the object directly, instead of creating a new Series
    or DataFrame.

Returns
-------
Series, DataFrame, or None
    The same type as the caller or None if `inplace` is True.

See Also
--------
Series.rename : Alter Series index labels or name.
DataFrame.rename : Alter DataFrame index labels or name.
Index.rename : Set new names on index.

Notes
-----
Prior to version 0.21.0, ``rename_axis`` could also be used to change
the axis *labels* by passing a mapping or scalar. This behavior is
deprecated and will be removed in a future version. Use ``rename``
instead.

``DataFrame.rename_axis`` supports two calling conventions

* ``(index=index_mapper, columns=columns_mapper, ...)``
* ``(mapper, axis={'index', 'columns'}, ...)``

The first calling convention will only modify the names of
the index and/or the names of the Index object that is the columns.
In this case, the parameter ``copy`` is ignored.

The second calling convention will modify the names of the
the corresponding index if mapper is a list or a scalar.
However, if mapper is dict-like or a function, it will use the
deprecated behavior of modifying the axis *labels*.

We *highly* recommend using keyword arguments to clarify your
intent.

Examples
--------
**Series**

>>> s = pd.Series(["dog", "cat", "monkey"])
>>> s
0       dog
1       cat
2    monkey
dtype: object
>>> s.rename_axis("animal")
animal
0    dog
1    cat
2    monkey
dtype: object

**DataFrame**

>>> df = pd.DataFrame({"num_legs": [4, 4, 2],
...                    "num_arms": [0, 0, 2]},
...                   ["dog", "cat", "monkey"])
>>> df
        num_legs  num_arms
dog            4         0
cat            4         0
monkey         2         2
>>> df = df.rename_axis("animal")
>>> df
        num_legs  num_arms
animal
dog            4         0
cat            4         0
monkey         2         2
>>> df = df.rename_axis("limbs", axis="columns")
>>> df
limbs   num_legs  num_arms
animal
dog            4         0
cat            4         0
monkey         2         2

**MultiIndex**

>>> df.index = pd.MultiIndex.from_product([['mammal'],
...                                        ['dog', 'cat', 'monkey']],
...                                       names=['type', 'name'])
>>> df
limbs          num_legs  num_arms
type   name
mammal dog            4         0
       cat            4         0
       monkey         2         2

>>> df.rename_axis(index={'type': 'class'})
limbs          num_legs  num_arms
class  name
mammal dog            4         0
       cat            4         0
       monkey         2         2

>>> df.rename_axis(columns=str.upper)
LIMBS          num_legs  num_arms
type   name
mammal dog            4         0
       cat            4         0
       monkey         2         2