@@ -447,10 +447,26 @@ def test_arith_flex_frame(self):
447
447
448
448
result = self .frame [:0 ].add (self .frame )
449
449
assert_frame_equal (result , self .frame * np .nan )
450
- with tm .assert_raises_regex (NotImplementedError , 'fill_value' ):
451
- self .frame .add (self .frame .iloc [0 ], fill_value = 3 )
452
- with tm .assert_raises_regex (NotImplementedError , 'fill_value' ):
453
- self .frame .add (self .frame .iloc [0 ], axis = 'index' , fill_value = 3 )
450
+
451
+ def test_arith_fill (self ):
452
+ # GH 13488
453
+ df = DataFrame ([[10.0 , 11.0 , 12.0 , 13.0 ],
454
+ [20.0 , 21.0 , 22.0 , np .nan ],
455
+ [30.0 , np .nan , np .nan , np .nan ]])
456
+ s = Series ([0.0 , 1.0 , 2.0 , np .nan ])
457
+
458
+ by_columns = DataFrame ([[10.0 , 12.0 , 14.0 , 13.0 ],
459
+ [20.0 , 22.0 , 24.0 , 0.0 ],
460
+ [30.0 , 1.0 , 2.0 , 0.0 ]])
461
+ assert_frame_equal (by_columns ,
462
+ df .add (s , fill_value = 0.0 ))
463
+
464
+ by_index = DataFrame ([[10.0 , 11.0 , 12.0 , 13.0 ],
465
+ [21.0 , 22.0 , 23.0 , 1.0 ],
466
+ [32.0 , 2.0 , 2.0 , 2.0 ],
467
+ [0.0 , 0.0 , 0.0 , 0.0 ]])
468
+ assert_frame_equal (by_index ,
469
+ df .add (s , fill_value = 0.0 , axis = 'index' ))
454
470
455
471
def test_binary_ops_align (self ):
456
472
0 commit comments