@@ -913,20 +913,24 @@ def f(x):
913
913
rename .__doc__ = _shared_docs ['rename' ]
914
914
915
915
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.
917
918
918
919
Parameters
919
920
----------
920
921
mapper : scalar, list-like, optional
921
922
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.
923
925
copy : boolean, default True
924
- Also copy underlying data
926
+ Also copy underlying data.
925
927
inplace : boolean, default False
928
+ Modifies the mapper in place.
926
929
927
930
Returns
928
931
-------
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.
930
934
931
935
Notes
932
936
-----
@@ -937,12 +941,12 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
937
941
938
942
See Also
939
943
--------
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
942
947
943
948
Examples
944
949
--------
945
-
946
950
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
947
951
>>> df.rename_axis("foo")
948
952
A B
@@ -956,7 +960,6 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):
956
960
0 1 4
957
961
1 2 5
958
962
2 3 6
959
-
960
963
"""
961
964
inplace = validate_bool_kwarg (inplace , 'inplace' )
962
965
non_mapper = is_scalar (mapper ) or (is_list_like (mapper ) and not
0 commit comments