diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 3cb2b7c1b72720..9c3c11b808b37e 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2967,11 +2967,11 @@ def rename(self, mapper=None, index=None, columns=None, axis=None, Parameters ---------- - mapper : dict-like or function, optional - Applied to the axis specified by ``axis`` - index, columns : scalar, list-like, dict-like or function, optional + mapper, index, columns : dict-like or function, optional dict-like or functions transformations to apply to - that axis' values + that axis' values. Use either ``mapper`` and ``axis`` to + specify the axis to target with ``mapper``, or ``index`` and + ``columns``. axis : int or str, optional Axis to target with ``mapper``. Can be either the axis name ('index', 'columns') or number (0, 1). The default is 'index'. @@ -2990,7 +2990,7 @@ def rename(self, mapper=None, index=None, columns=None, axis=None, See Also -------- - pandas.NDFrame.rename_axis + pandas.DataFrame.rename_axis Examples -------- diff --git a/pandas/core/series.py b/pandas/core/series.py index 0a9eb77f199a7c..8f495e38105a08 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2526,7 +2526,7 @@ def align(self, other, join='outer', axis=None, level=None, copy=True, broadcast_axis=broadcast_axis) def rename(self, index=None, **kwargs): - """Alter Series row labels or name + """Alter Series index labels or name Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an @@ -2538,10 +2538,11 @@ def rename(self, index=None, **kwargs): Parameters ---------- - index : scalar, list-like, dict-like or function, optional + index : scalar, hashable sequence, dict-like or function, optional dict-like or functions are transformations to apply to the index. - Scalar or list-like will alter the ``Series.name`` attribute. + Scalar or hashable sequence-like will alter the ``Series.name`` + attribute. copy : boolean, default True Also copy underlying data inplace : boolean, default False @@ -2557,7 +2558,7 @@ def rename(self, index=None, **kwargs): See Also -------- - pandas.DataFrame.rename_axis + pandas.Series.rename_axis Examples --------