From a43d16f562be824599e04d9e1cbd29315c89c36d Mon Sep 17 00:00:00 2001 From: Brian Choi Date: Wed, 3 Oct 2018 01:28:14 -0700 Subject: [PATCH] DOC: Fixed the doctsring for _set_axis_name (GH 22895) --- pandas/core/generic.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 393e7caae5fab..03e24039f16fe 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1207,31 +1207,34 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False): def _set_axis_name(self, name, axis=0, inplace=False): """ - Alter the name or names of the axis. + Alter the label(s) of the axis. Parameters ---------- name : str or list of str - Name for the Index, or list of names for the MultiIndex - axis : int or str - 0 or 'index' for the index; 1 or 'columns' for the columns - inplace : bool - whether to modify `self` directly or return a copy + Labels(s) to set. + axis : int or str, default 0 + The axis to set the label. The value 0 or 'index' specifies index, + and the value 1 or 'columns' specifies columns. + inplace : bool, default False + Whether to modify `self` directly or return a copy. .. versionadded:: 0.21.0 Returns ------- - renamed : same type as caller or None if inplace=True + Series, DataFrame, Panel, or None + The same type as the caller or `None` if `inplace` is `True`. See Also -------- - pandas.DataFrame.rename - pandas.Series.rename - pandas.Index.rename + pandas.DataFrame.rename : Alter the labels of the axis of an object of :class:`DataFrame`. + pandas.Series.rename : Alter the name or the labels of an object of :class:`Series`. + pandas.Index.rename : Alter the name of an object of :class:`Index` or :class:`MultiIndex`. Examples -------- + >>> df = pd.DataFrame({"A": [1, 2, 3]}) >>> df._set_axis_name("foo") A foo