Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d34d2b6

Browse files
committedMar 10, 2018
DOC: update pandas.Series.rename_axis
1 parent 52cffa3 commit d34d2b6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed
 

‎pandas/core/generic.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -913,20 +913,26 @@ 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.
918+
919+
This function alters the name of the index or columns.
917920
918921
Parameters
919922
----------
920923
mapper : scalar, list-like, optional
921924
Value to set the axis name attribute.
922-
axis : int or string, default 0
925+
axis : int, str, default 0
926+
The index or the name of the axis.
923927
copy : boolean, default True
924-
Also copy underlying data
928+
Also copy underlying data.
925929
inplace : boolean, default False
930+
Modifies the mapper in place.
926931
927932
Returns
928933
-------
929-
renamed : type of caller or None if inplace=True
934+
type of caller or None if inplace=True
935+
Renamed
930936
931937
Notes
932938
-----
@@ -937,12 +943,12 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
937943
938944
See Also
939945
--------
940-
pandas.Series.rename, pandas.DataFrame.rename
941-
pandas.Index.rename
946+
pandas.Series.rename : Alter Series index labels or name
947+
pandas.DataFrame.rename : Alter DataFrame index labels or name
948+
pandas.Index.rename : Set new names on index
942949
943950
Examples
944951
--------
945-
946952
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
947953
>>> df.rename_axis("foo")
948954
A B
@@ -956,7 +962,6 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
956962
0 1 4
957963
1 2 5
958964
2 3 6
959-
960965
"""
961966
inplace = validate_bool_kwarg(inplace, 'inplace')
962967
non_mapper = is_scalar(mapper) or (is_list_like(mapper) and not

0 commit comments

Comments
 (0)
Please sign in to comment.