Skip to content

Commit 2f63055

Browse files
committed
BUG: fix bug with replace when a compiled regex was passed but regex=False
1 parent 9f218eb commit 2f63055

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

pandas/core/internals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ def replace(self, to_replace, value, inplace=False, filter=None,
746746
both_lists = to_rep_is_list and value_is_list
747747
either_list = to_rep_is_list or value_is_list
748748

749-
if not either_list and com.is_re_compilable(to_replace):
749+
if not either_list and com.is_re(to_replace):
750750
blk[0], = blk[0]._replace_single(to_replace, value,
751751
inplace=inplace, filter=filter,
752752
regex=True)

pandas/tests/test_frame.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6778,7 +6778,6 @@ def test_replace_list(self):
67786778

67796779
## lists of regexes and values
67806780
# list of [v1, v2, ..., vN] -> [v1, v2, ..., vN]
6781-
import ipdb; ipdb.set_trace()
67826781
to_replace_res = [r'.', r'e']
67836782
values = [nan, 'crap']
67846783
res = dfobj.replace(to_replace_res, values)

0 commit comments

Comments
 (0)