Skip to content

Commit 4bcaf1c

Browse files
committed
Add replace test for nil gh32075
Signed-off-by: Liang Yan <[email protected]>
1 parent 73dfc30 commit 4bcaf1c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/series/methods/test_replace.py

+7
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,13 @@ def test_replace_with_dictlike_and_string_dtype(self, nullable_string_dtype):
318318
result = ser.replace({"one": "1", "two": "2"})
319319
tm.assert_series_equal(expected, result)
320320

321+
def test_replace_with_nil_na(self):
322+
# GH 32075
323+
ser = pd.DataFrame({"a": ["nil", pd.NA]})
324+
expected = pd.DataFrame({"a": ["anything else", pd.NA]}, index=[0, 1])
325+
result = ser.replace("nil", "anything else")
326+
tm.assert_frame_equal(expected, result)
327+
321328
def test_replace_with_empty_dictlike(self):
322329
# GH 15289
323330
s = pd.Series(list("abcd"))

0 commit comments

Comments
 (0)