Skip to content

Commit c1e91f9

Browse files
committed
DOC: update pandas.Series.rename_axis
1 parent 52cffa3 commit c1e91f9

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

pandas/core/generic.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -913,20 +913,24 @@ def f(x):
913913
rename.__doc__ = _shared_docs['rename']
914914

915915
def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
916-
"""Alter the name of the index or columns.
916+
"""
917+
Alter the name of the index or columns.
917918
918919
Parameters
919920
----------
920921
mapper : scalar, list-like, optional
921922
Value to set the axis name attribute.
922-
axis : int or string, default 0
923+
axis : {0 or 'index', 1 or 'columns'}, default 0
924+
The index or the name of the axis.
923925
copy : boolean, default True
924-
Also copy underlying data
926+
Also copy underlying data.
925927
inplace : boolean, default False
928+
Modifies the mapper in place.
926929
927930
Returns
928931
-------
929-
renamed : type of caller or None if inplace=True
932+
renamed : Series, DataFrame, or None
933+
The same type as the caller or None ifa` inplace` is True.
930934
931935
Notes
932936
-----
@@ -937,12 +941,12 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
937941
938942
See Also
939943
--------
940-
pandas.Series.rename, pandas.DataFrame.rename
941-
pandas.Index.rename
944+
pandas.Series.rename : Alter Series index labels or name
945+
pandas.DataFrame.rename : Alter DataFrame index labels or name
946+
pandas.Index.rename : Set new names on index
942947
943948
Examples
944949
--------
945-
946950
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
947951
>>> df.rename_axis("foo")
948952
A B
@@ -956,7 +960,6 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
956960
0 1 4
957961
1 2 5
958962
2 3 6
959-
960963
"""
961964
inplace = validate_bool_kwarg(inplace, 'inplace')
962965
non_mapper = is_scalar(mapper) or (is_list_like(mapper) and not

0 commit comments

Comments
 (0)