@@ -408,8 +408,10 @@ def _get_op_name(op, special):
408
408
----------
409
409
other : Series or scalar value
410
410
fill_value : None or float value, default None (NaN)
411
- Fill missing (NaN) values with this value. If both Series are
412
- missing, the result will be missing
411
+ Fill existing missing (NaN) values, and any new element needed for
412
+ successful Series alignment, with this value before computation.
413
+ If data in both corresponding Series locations is missing
414
+ the result will be missing
413
415
level : int or name
414
416
Broadcast across a level, matching Index values on the
415
417
passed MultiIndex level
@@ -418,6 +420,30 @@ def _get_op_name(op, special):
418
420
-------
419
421
result : Series
420
422
423
+ Examples
424
+ --------
425
+ >>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
426
+ >>> a
427
+ a 1.0
428
+ b 1.0
429
+ c 1.0
430
+ d NaN
431
+ dtype: float64
432
+ >>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
433
+ >>> b
434
+ a 1.0
435
+ b NaN
436
+ d 1.0
437
+ e NaN
438
+ dtype: float64
439
+ >>> a.add(b, fill_value=0)
440
+ a 2.0
441
+ b 1.0
442
+ c 1.0
443
+ d 1.0
444
+ e NaN
445
+ dtype: float64
446
+
421
447
See also
422
448
--------
423
449
Series.{reverse}
@@ -433,8 +459,10 @@ def _get_op_name(op, special):
433
459
axis : {0, 1, 'index', 'columns'}
434
460
For Series input, axis to match Series index on
435
461
fill_value : None or float value, default None
436
- Fill missing (NaN) values with this value. If both DataFrame locations are
437
- missing, the result will be missing
462
+ Fill existing missing (NaN) values, and any new element needed for
463
+ successful DataFrame alignment, with this value before computation.
464
+ If data in both corresponding DataFrame locations is missing
465
+ the result will be missing
438
466
level : int or name
439
467
Broadcast across a level, matching Index values on the
440
468
passed MultiIndex level
@@ -446,6 +474,33 @@ def _get_op_name(op, special):
446
474
Returns
447
475
-------
448
476
result : DataFrame
477
+
478
+ Examples
479
+ --------
480
+ >>> a = pd.DataFrame([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'],
481
+ columns=['one'])
482
+ >>> a
483
+ one
484
+ a 1.0
485
+ b 1.0
486
+ c 1.0
487
+ d NaN
488
+ >>> b = pd.DataFrame(dict(one=[1, np.nan, 1, np.nan],
489
+ two=[np.nan, 2, np.nan, 2]),
490
+ index=['a', 'b', 'd', 'e'])
491
+ >>> b
492
+ one two
493
+ a 1.0 NaN
494
+ b NaN 2.0
495
+ d 1.0 NaN
496
+ e NaN 2.0
497
+ >>> a.add(b, fill_value=0)
498
+ one two
499
+ a 2.0 NaN
500
+ b 1.0 2.0
501
+ c 1.0 NaN
502
+ d 1.0 NaN
503
+ e NaN 2.0
449
504
"""
450
505
451
506
_flex_doc_FRAME = """
@@ -460,8 +515,10 @@ def _get_op_name(op, special):
460
515
axis : {{0, 1, 'index', 'columns'}}
461
516
For Series input, axis to match Series index on
462
517
fill_value : None or float value, default None
463
- Fill missing (NaN) values with this value. If both DataFrame
464
- locations are missing, the result will be missing
518
+ Fill existing missing (NaN) values, and any new element needed for
519
+ successful DataFrame alignment, with this value before computation.
520
+ If data in both corresponding DataFrame locations is missing
521
+ the result will be missing
465
522
level : int or name
466
523
Broadcast across a level, matching Index values on the
467
524
passed MultiIndex level
@@ -474,6 +531,33 @@ def _get_op_name(op, special):
474
531
-------
475
532
result : DataFrame
476
533
534
+ Examples
535
+ --------
536
+ >>> a = pd.DataFrame([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'],
537
+ columns=['one'])
538
+ >>> a
539
+ one
540
+ a 1.0
541
+ b 1.0
542
+ c 1.0
543
+ d NaN
544
+ >>> b = pd.DataFrame(dict(one=[1, np.nan, 1, np.nan],
545
+ two=[np.nan, 2, np.nan, 2]),
546
+ index=['a', 'b', 'd', 'e'])
547
+ >>> b
548
+ one two
549
+ a 1.0 NaN
550
+ b NaN 2.0
551
+ d 1.0 NaN
552
+ e NaN 2.0
553
+ >>> a.add(b, fill_value=0)
554
+ one two
555
+ a 2.0 NaN
556
+ b 1.0 2.0
557
+ c 1.0 NaN
558
+ d 1.0 NaN
559
+ e NaN 2.0
560
+
477
561
See also
478
562
--------
479
563
DataFrame.{reverse}
@@ -545,7 +629,6 @@ def _make_flex_doc(op_name, typ):
545
629
base_doc = _flex_doc_PANEL
546
630
else :
547
631
raise AssertionError ('Invalid typ argument.' )
548
-
549
632
doc = base_doc .format (desc = op_desc ['desc' ], op_name = op_name ,
550
633
equiv = equiv , reverse = op_desc ['reverse' ])
551
634
return doc
0 commit comments