Skip to content

Commit

Permalink
Add replace test for nil gh32075
Browse files Browse the repository at this point in the history
Signed-off-by: Liang Yan <ckgppl_yan@sina.cn>
  • Loading branch information
liang3zy22 committed Mar 14, 2023
1 parent 506fe53 commit 57c0b4b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pandas/tests/frame/methods/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,13 @@ def test_replace_value_none_dtype_numeric(self, val):
result = df.replace({val: None})
tm.assert_frame_equal(result, expected)

def test_replace_with_nil_na(self):
# GH 32075
ser = DataFrame({"a": ["nil", pd.NA]})
expected = DataFrame({"a": ["anything else", pd.NA]}, index=[0, 1])
result = ser.replace("nil", "anything else")
tm.assert_frame_equal(expected, result)


class TestDataFrameReplaceRegex:
@pytest.mark.parametrize(
Expand Down

0 comments on commit 57c0b4b

Please sign in to comment.