@@ -703,12 +703,31 @@ def _radd_compat(left, right):
703
703
704
704
return output
705
705
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' }
706
720
707
721
def _flex_method_SERIES (op , name , str_rep , default_axis = None ,
708
722
fill_zeros = None , ** eval_kwargs ):
723
+ desc = name
724
+ if _op_descriptions .get (name ):
725
+ desc = desc + ' (' + _op_descriptions .get (name ) + ')'
726
+
709
727
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.
712
731
713
732
Parameters
714
733
----------
@@ -723,7 +742,7 @@ def _flex_method_SERIES(op, name, str_rep, default_axis=None,
723
742
Returns
724
743
-------
725
744
result : Series
726
- """ % name
745
+ """ % desc
727
746
728
747
@Appender (doc )
729
748
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):
754
773
755
774
756
775
_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
758
778
one of the inputs
759
779
760
780
Parameters
@@ -813,7 +833,11 @@ def na_op(x, y):
813
833
814
834
return result
815
835
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 )
817
841
def f (self , other , axis = default_axis , level = None , fill_value = None ):
818
842
if isinstance (other , pd .DataFrame ): # Another DataFrame
819
843
return self ._combine_frame (other , na_op , fill_value , level )
0 commit comments