@@ -703,12 +703,31 @@ def _radd_compat(left, right):
703703
704704 return output
705705
706+ _op_descriptions = {'add' : 'addition' ,
707+ 'radd' : 'addition in the reverse order of operands compared to add' ,
708+ 'sub' : 'subtraction' ,
709+ 'rsub' : 'subtraction in the reverse order of operands compared to sub' ,
710+ 'mul' : 'multiplication' ,
711+ 'rmul' : 'multiplication in the reverse order of operands compared to mul' ,
712+ 'mod' : 'modulo' ,
713+ 'rmod' : 'modulo in the reverse order of operands compared to mod' ,
714+ 'pow' : 'exponential power' ,
715+ 'rpow' : 'exponential power in the reverse order of operands compared to pow' ,
716+ 'truediv' : 'floating division' ,
717+ 'rtruediv' : 'floating division in the reverse order of operands compared to truediv' ,
718+ 'floordiv' : 'integer division' ,
719+ 'rfloordiv' : 'integer division in the reverse order of operands compared to floordiv' }
706720
707721def _flex_method_SERIES (op , name , str_rep , default_axis = None ,
708722 fill_zeros = None , ** eval_kwargs ):
723+ desc = name
724+ if _op_descriptions .get (name ):
725+ desc = desc + ' (' + _op_descriptions .get (name ) + ')'
726+
709727 doc = """
710- Binary operator %s with support to substitute a fill_value for missing data
711- in one of the inputs
728+ Binary operator %s.
729+ This supports substituting a fill_value for missing data
730+ in one of the inputs.
712731
713732 Parameters
714733 ----------
@@ -723,7 +742,7 @@ def _flex_method_SERIES(op, name, str_rep, default_axis=None,
723742 Returns
724743 -------
725744 result : Series
726- """ % name
745+ """ % desc
727746
728747 @Appender (doc )
729748 def flex_wrapper (self , other , level = None , fill_value = None , axis = 0 ):
@@ -754,7 +773,8 @@ def flex_wrapper(self, other, level=None, fill_value=None, axis=0):
754773
755774
756775_arith_doc_FRAME = """
757- Binary operator %s with support to substitute a fill_value for missing data in
776+ Binary operator %s.
777+ This supports substituting a fill_value for missing data in
758778one of the inputs
759779
760780Parameters
@@ -813,7 +833,11 @@ def na_op(x, y):
813833
814834 return result
815835
816- @Appender (_arith_doc_FRAME % name )
836+ desc = name
837+ if _op_descriptions .get (name ):
838+ desc = desc + ' (' + _op_descriptions .get (name ) + ')'
839+
840+ @Appender (_arith_doc_FRAME % desc )
817841 def f (self , other , axis = default_axis , level = None , fill_value = None ):
818842 if isinstance (other , pd .DataFrame ): # Another DataFrame
819843 return self ._combine_frame (other , na_op , fill_value , level )
0 commit comments