Skip to content

Commit 89ab738

Browse files
committed
test for pd.where overflow error pandas-dev#31687
1 parent d69e63d commit 89ab738

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/frame/indexing/test_where.py

+10
Original file line numberDiff line numberDiff line change
@@ -1017,3 +1017,13 @@ def test_where_producing_ea_cond_for_np_dtype():
10171017
{"a": Series([pd.NA, pd.NA, 2], dtype="Int64"), "b": [np.nan, 2, 3]}
10181018
)
10191019
tm.assert_frame_equal(result, expected)
1020+
1021+
1022+
@pytest.mark.parametrize("replacement", [0.001, True, "snake"])
1023+
def test_where_int_overflow(replacement):
1024+
# GH 31687
1025+
df = DataFrame([[1.0, 2e19, "nine"],[np.nan, 0.1, None]])
1026+
result = df.where(pd.notnull(df), replacement)
1027+
expected = DataFrame([[1.0, 2e19, "nine"],[replacement, 0.1, replacement]])
1028+
1029+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)