@@ -486,6 +486,30 @@ def _get_op_name(op, special):
486
486
e NaN -4.0 NaN
487
487
"""
488
488
489
+ _mul_example_FRAME = """
490
+ >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
491
+ >>> a
492
+ a 1.0
493
+ b 1.0
494
+ c 1.0
495
+ d NaN
496
+ dtype: float64
497
+ >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
498
+ >>> b
499
+ a 1.0
500
+ b NaN
501
+ d 1.0
502
+ e NaN
503
+ dtype: float64
504
+ >>> a.multiply(b, fill_value=0)
505
+ a 1.0
506
+ b 0.0
507
+ c 0.0
508
+ d 0.0
509
+ e NaN
510
+ dtype: float64
511
+ """
512
+
489
513
_op_descriptions = {
490
514
# Arithmetic Operators
491
515
'add' : {'op' : '+' ,
@@ -499,7 +523,7 @@ def _get_op_name(op, special):
499
523
'mul' : {'op' : '*' ,
500
524
'desc' : 'Multiplication' ,
501
525
'reverse' : 'rmul' ,
502
- 'df_examples' : None },
526
+ 'df_examples' : _mul_example_FRAME },
503
527
'mod' : {'op' : '%' ,
504
528
'desc' : 'Modulo' ,
505
529
'reverse' : 'rmod' ,
@@ -580,31 +604,12 @@ def _get_op_name(op, special):
580
604
581
605
Examples
582
606
--------
583
- >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
584
- >>> a
585
- a 1.0
586
- b 1.0
587
- c 1.0
588
- d NaN
589
- dtype: float64
590
- >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
591
- >>> b
592
- a 1.0
593
- b NaN
594
- d 1.0
595
- e NaN
596
- dtype: float64
597
- >>> a.add(b, fill_value=0)
598
- a 2.0
599
- b 1.0
600
- c 1.0
601
- d 1.0
602
- e NaN
603
- dtype: float64
607
+ {df_examples}
604
608
605
609
See also
606
610
--------
607
611
Series.{reverse}
612
+
608
613
"""
609
614
610
615
_arith_doc_FRAME = """
@@ -690,7 +695,6 @@ def _get_op_name(op, special):
690
695
Panel.{reverse}
691
696
"""
692
697
693
-
694
698
_agg_doc_PANEL = """
695
699
Wrapper method for {op_name}
696
700
@@ -732,7 +736,8 @@ def _make_flex_doc(op_name, typ):
732
736
if typ == 'series' :
733
737
base_doc = _flex_doc_SERIES
734
738
doc = base_doc .format (desc = op_desc ['desc' ], op_name = op_name ,
735
- equiv = equiv , reverse = op_desc ['reverse' ])
739
+ equiv = equiv , reverse = op_desc ['reverse' ],
740
+ df_examples = op_desc ['df_examples' ])
736
741
elif typ == 'dataframe' :
737
742
base_doc = _flex_doc_FRAME
738
743
doc = base_doc .format (desc = op_desc ['desc' ], op_name = op_name ,
@@ -1296,7 +1301,7 @@ def wrapper(left, right):
1296
1301
"{op}" .format (typ = type (left ).__name__ , op = str_rep ))
1297
1302
1298
1303
elif (is_extension_array_dtype (left ) or
1299
- (is_extension_array_dtype (right ) and not is_scalar (right ))):
1304
+ (is_extension_array_dtype (right ) and not is_scalar (right ))):
1300
1305
# GH#22378 disallow scalar to exclude e.g. "category", "Int64"
1301
1306
return dispatch_to_extension_op (op , left , right )
1302
1307
0 commit comments