@@ -3468,8 +3468,8 @@ def replace(self, to_replace, value=None, method='pad', axis=0,
3468
3468
return self
3469
3469
3470
3470
new_data = self ._data
3471
- if isinstance (to_replace , dict ):
3472
- if isinstance (value , dict ): # {'A' : NA} -> {'A' : 0}
3471
+ if isinstance (to_replace , ( dict , Series ) ):
3472
+ if isinstance (value , ( dict , Series ) ): # {'A' : NA} -> {'A' : 0}
3473
3473
new_data = self ._data
3474
3474
for c , src in to_replace .iteritems ():
3475
3475
if c in value and c in self :
@@ -3481,7 +3481,7 @@ def replace(self, to_replace, value=None, method='pad', axis=0,
3481
3481
if k in self :
3482
3482
new_data = new_data .replace (src , value , filter = [ k ], inplace = inplace )
3483
3483
else :
3484
- raise ValueError ('Fill value must be scalar or dict' )
3484
+ raise ValueError ('Fill value must be scalar or dict or Series ' )
3485
3485
3486
3486
elif isinstance (to_replace , (list , np .ndarray )):
3487
3487
# [NA, ''] -> [0, 'missing']
@@ -3501,7 +3501,7 @@ def replace(self, to_replace, value=None, method='pad', axis=0,
3501
3501
else :
3502
3502
3503
3503
# dest iterable dict-like
3504
- if isinstance (value , dict ): # NA -> {'A' : 0, 'B' : -1}
3504
+ if isinstance (value , ( dict , Series ) ): # NA -> {'A' : 0, 'B' : -1}
3505
3505
3506
3506
new_data = self ._data
3507
3507
for k , v in value .iteritems ():
@@ -3528,7 +3528,7 @@ def _interpolate(self, to_replace, method, axis, inplace, limit):
3528
3528
3529
3529
method = com ._clean_fill_method (method )
3530
3530
3531
- if isinstance (to_replace , dict ):
3531
+ if isinstance (to_replace , ( dict , Series ) ):
3532
3532
if axis == 1 :
3533
3533
return self .T .replace (to_replace , method = method ,
3534
3534
limit = limit ).T
0 commit comments