Skip to content

Commit

Permalink
revert generic
Browse files Browse the repository at this point in the history
  • Loading branch information
minggli committed Jul 27, 2018
1 parent 941fccb commit 389ebcd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6004,7 +6004,7 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
# {'A': NA} -> 0
elif not is_list_like(value):
keys = [(k, src) for k, src in compat.iteritems(to_replace)
if k in self and len(src) > 0]
if k in self]
keys_len = len(keys) - 1
for i, (k, src) in enumerate(keys):
convert = i == keys_len
Expand All @@ -6018,8 +6018,7 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
raise TypeError('value argument must be scalar, dict, or '
'Series')

# [NA, ''] -> [0, 'missing']
elif is_list_like(to_replace):
elif is_list_like(to_replace): # [NA, ''] -> [0, 'missing']
if is_list_like(value):
if len(to_replace) != len(value):
raise ValueError('Replacement lists must match '
Expand All @@ -6031,8 +6030,7 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
inplace=inplace,
regex=regex)

# [NA, ''] -> 0
elif len(to_replace) > 0:
else: # [NA, ''] -> 0
new_data = self._data.replace(to_replace=to_replace,
value=value, inplace=inplace,
regex=regex)
Expand Down

0 comments on commit 389ebcd

Please sign in to comment.