Skip to content

Commit 2fbb809

Browse files
pv8473h12proost
authored andcommitted
Pv feature2 (pandas-dev#29354)
1 parent e256811 commit 2fbb809

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/series/test_replace.py

+12
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,15 @@ def test_replace_with_no_overflowerror(self):
305305
result = s.replace(["100000000000000000000"], [1])
306306
expected = pd.Series([0, 1, "100000000000000000001"])
307307
tm.assert_series_equal(result, expected)
308+
309+
@pytest.mark.parametrize(
310+
"ser, exp", [([1, 2, 3], [1, True, 3]), (["x", 2, 3], ["x", True, 3])]
311+
)
312+
def test_replace_no_cast(self, ser, exp):
313+
# GH 9113
314+
# BUG: replace int64 dtype with bool coerces to int64
315+
316+
series = pd.Series(ser)
317+
result = series.replace(2, True)
318+
expected = pd.Series(exp)
319+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)