@@ -643,7 +643,8 @@ def _set_axis(self, axis, labels):
643643 self ._data .set_axis (axis , labels )
644644 self ._clear_item_cache ()
645645
646- _shared_docs ['transpose' ] = """
646+ def transpose (self , * args , ** kwargs ):
647+ """
647648 Permute the dimensions of the %(klass)s
648649
649650 Parameters
@@ -663,9 +664,6 @@ def _set_axis(self, axis, labels):
663664 y : same as input
664665 """
665666
666- @Appender (_shared_docs ['transpose' ] % _shared_doc_kwargs )
667- def transpose (self , * args , ** kwargs ):
668-
669667 # construct the args
670668 axes , kwargs = self ._construct_axes_from_arguments (args , kwargs ,
671669 require_all = True )
@@ -965,23 +963,20 @@ def swaplevel(self, i=-2, j=-1, axis=0):
965963 # ----------------------------------------------------------------------
966964 # Rename
967965
968- # TODO: define separate funcs for DataFrame, Series and Panel so you can
969- # get completion on keyword arguments.
970- _shared_docs ['rename' ] = """
966+ def rename (self , * args , ** kwargs ):
967+ """
971968 Alter axes input function or functions. Function / dict values must be
972969 unique (1-to-1). Labels not contained in a dict / Series will be left
973970 as-is. Extra labels listed don't throw an error. Alternatively, change
974971 ``Series.name`` with a scalar value (Series only).
975972
976973 Parameters
977974 ----------
978- %(optional_mapper)s
979975 %(axes)s : scalar, list-like, dict-like or function, optional
980976 Scalar or list-like will alter the ``Series.name`` attribute,
981977 and raise on DataFrame or Panel.
982978 dict-like or functions are transformations to apply to
983979 that axis' values
984- %(optional_axis)s
985980 copy : boolean, default True
986981 Also copy underlying data
987982 inplace : boolean, default False
@@ -1069,12 +1064,6 @@ def swaplevel(self, i=-2, j=-1, axis=0):
10691064
10701065 See the :ref:`user guide <basics.rename>` for more.
10711066 """
1072-
1073- @Appender (_shared_docs ['rename' ] % dict (axes = 'axes keywords for this'
1074- ' object' , klass = 'NDFrame' ,
1075- optional_mapper = '' ,
1076- optional_axis = '' ))
1077- def rename (self , * args , ** kwargs ):
10781067 axes , kwargs = self ._construct_axes_from_arguments (args , kwargs )
10791068 copy = kwargs .pop ('copy' , True )
10801069 inplace = kwargs .pop ('inplace' , False )
@@ -1127,8 +1116,6 @@ def f(x):
11271116 else :
11281117 return result .__finalize__ (self )
11291118
1130- rename .__doc__ = _shared_docs ['rename' ]
1131-
11321119 def rename_axis (self , mapper , axis = 0 , copy = True , inplace = False ):
11331120 """
11341121 Alter the name of the index or columns.
@@ -3024,7 +3011,8 @@ def __delitem__(self, key):
30243011 except KeyError :
30253012 pass
30263013
3027- _shared_docs ['_take' ] = """
3014+ def _take (self , indices , axis = 0 , is_copy = True ):
3015+ """
30283016 Return the elements in the given *positional* indices along an axis.
30293017
30303018 This means that we are not indexing according to actual values in
@@ -3055,9 +3043,6 @@ def __delitem__(self, key):
30553043 numpy.ndarray.take
30563044 numpy.take
30573045 """
3058-
3059- @Appender (_shared_docs ['_take' ])
3060- def _take (self , indices , axis = 0 , is_copy = True ):
30613046 self ._consolidate_inplace ()
30623047
30633048 new_data = self ._data .take (indices ,
@@ -3072,7 +3057,8 @@ def _take(self, indices, axis=0, is_copy=True):
30723057
30733058 return result
30743059
3075- _shared_docs ['take' ] = """
3060+ def take (self , indices , axis = 0 , convert = None , is_copy = True , ** kwargs ):
3061+ """
30763062 Return the elements in the given *positional* indices along an axis.
30773063
30783064 This means that we are not indexing according to actual values in
@@ -3155,9 +3141,6 @@ class max_speed
31553141 1 monkey mammal NaN
31563142 3 lion mammal 80.5
31573143 """
3158-
3159- @Appender (_shared_docs ['take' ])
3160- def take (self , indices , axis = 0 , convert = None , is_copy = True , ** kwargs ):
31613144 if convert is not None :
31623145 msg = ("The 'convert' parameter is deprecated "
31633146 "and will be removed in a future version." )
@@ -3580,7 +3563,9 @@ def add_suffix(self, suffix):
35803563 mapper = {self ._info_axis_name : f }
35813564 return self .rename (** mapper )
35823565
3583- _shared_docs ['sort_values' ] = """
3566+ def sort_values (self , by = None , axis = 0 , ascending = True , inplace = False ,
3567+ kind = 'quicksort' , na_position = 'last' ):
3568+ """
35843569 Sort by the values along either axis
35853570
35863571 Parameters
@@ -3665,17 +3650,12 @@ def add_suffix(self, suffix):
36653650 0 A 2 0
36663651 1 A 1 1
36673652 """
3668-
3669- def sort_values (self , by = None , axis = 0 , ascending = True , inplace = False ,
3670- kind = 'quicksort' , na_position = 'last' ):
3671- """
3672- NOT IMPLEMENTED: do not call this method, as sorting values is not
3673- supported for Panel objects and will raise an error.
3674- """
36753653 raise NotImplementedError ("sort_values has not been implemented "
36763654 "on Panel or Panel4D objects." )
36773655
3678- _shared_docs ['sort_index' ] = """
3656+ def sort_index (self , axis = 0 , level = None , ascending = True , inplace = False ,
3657+ kind = 'quicksort' , na_position = 'last' , sort_remaining = True ):
3658+ """
36793659 Sort object by labels (along an axis)
36803660
36813661 Parameters
@@ -3703,10 +3683,6 @@ def sort_values(self, by=None, axis=0, ascending=True, inplace=False,
37033683 -------
37043684 sorted_obj : %(klass)s
37053685 """
3706-
3707- @Appender (_shared_docs ['sort_index' ] % dict (axes = "axes" , klass = "NDFrame" ))
3708- def sort_index (self , axis = 0 , level = None , ascending = True , inplace = False ,
3709- kind = 'quicksort' , na_position = 'last' , sort_remaining = True ):
37103686 inplace = validate_bool_kwarg (inplace , 'inplace' )
37113687 axis = self ._get_axis_number (axis )
37123688 axis_name = self ._get_axis_name (axis )
@@ -3724,7 +3700,8 @@ def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
37243700 new_axis = labels .take (sort_index )
37253701 return self .reindex (** {axis_name : new_axis })
37263702
3727- _shared_docs ['reindex' ] = """
3703+ def reindex (self , * args , ** kwargs ):
3704+ """
37283705 Conform %(klass)s to new index with optional filling logic, placing
37293706 NA/NaN in locations having no value in the previous index. A new object
37303707 is produced unless the new index is equivalent to the current one and
@@ -3920,14 +3897,8 @@ def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
39203897 -------
39213898 reindexed : %(klass)s
39223899 """
3923-
3924- # TODO: Decide if we care about having different examples for different
3925- # kinds
3926-
3927- @Appender (_shared_docs ['reindex' ] % dict (axes = "axes" , klass = "NDFrame" ,
3928- optional_labels = "" ,
3929- optional_axis = "" ))
3930- def reindex (self , * args , ** kwargs ):
3900+ # TODO: Decide if we care about having different examples for different
3901+ # kinds
39313902
39323903 # construct the args
39333904 axes , kwargs = self ._construct_axes_from_arguments (args , kwargs )
0 commit comments