@@ -5041,7 +5041,6 @@ def rename_axis(
5041
5041
) -> Self | None :
5042
5042
...
5043
5043
5044
- @doc (NDFrame .rename_axis )
5045
5044
def rename_axis (
5046
5045
self ,
5047
5046
mapper : IndexLabel | lib .NoDefault = lib .no_default ,
@@ -5051,6 +5050,67 @@ def rename_axis(
5051
5050
copy : bool = True ,
5052
5051
inplace : bool = False ,
5053
5052
) -> Self | None :
5053
+ """
5054
+ Set the name of the axis for the index.
5055
+
5056
+ Parameters
5057
+ ----------
5058
+ mapper : scalar, list-like, optional
5059
+ Value to set the axis name attribute.
5060
+
5061
+ Use either ``mapper`` and ``axis`` to
5062
+ specify the axis to target with ``mapper``, or ``index``.
5063
+
5064
+ index : scalar, list-like, dict-like or function, optional
5065
+ A scalar, list-like, dict-like or functions transformations to
5066
+ apply to that axis' values.
5067
+ axis : {0 or 'index'}, default 0
5068
+ The axis to rename. For `Series` this parameter is unused and defaults to 0.
5069
+ copy : bool, default None
5070
+ Also copy underlying data.
5071
+
5072
+ .. note::
5073
+ The `copy` keyword will change behavior in pandas 3.0.
5074
+ `Copy-on-Write
5075
+ <https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
5076
+ will be enabled by default, which means that all methods with a
5077
+ `copy` keyword will use a lazy copy mechanism to defer the copy and
5078
+ ignore the `copy` keyword. The `copy` keyword will be removed in a
5079
+ future version of pandas.
5080
+
5081
+ You can already get the future behavior and improvements through
5082
+ enabling copy on write ``pd.options.mode.copy_on_write = True``
5083
+ inplace : bool, default False
5084
+ Modifies the object directly, instead of creating a new Series
5085
+ or DataFrame.
5086
+
5087
+ Returns
5088
+ -------
5089
+ Series, or None
5090
+ The same type as the caller or None if ``inplace=True``.
5091
+
5092
+ See Also
5093
+ --------
5094
+ Series.rename : Alter Series index labels or name.
5095
+ DataFrame.rename : Alter DataFrame index labels or name.
5096
+ Index.rename : Set new names on index.
5097
+
5098
+ Examples
5099
+ --------
5100
+
5101
+ >>> s = pd.Series(["dog", "cat", "monkey"])
5102
+ >>> s
5103
+ 0 dog
5104
+ 1 cat
5105
+ 2 monkey
5106
+ dtype: object
5107
+ >>> s.rename_axis("animal")
5108
+ animal
5109
+ 0 dog
5110
+ 1 cat
5111
+ 2 monkey
5112
+ dtype: object
5113
+ """
5054
5114
return super ().rename_axis (
5055
5115
mapper = mapper ,
5056
5116
index = index ,
0 commit comments