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