Skip to content

Commit 23d38dc

Browse files
author
MarcoGorelli
committed
one more
1 parent df0c849 commit 23d38dc

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

pandas/tests/frame/indexing/test_mask.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def test_mask_return_dtype():
145145

146146
def test_mask_inplace_no_other():
147147
# GH#51685
148-
df = DataFrame({"a": [1, 2], "b": ["x", "y"]})
148+
df = DataFrame({"a": [1.0, 2.0], "b": ["x", "y"]})
149149
cond = DataFrame({"a": [True, False], "b": [False, True]})
150150
df.mask(cond, inplace=True)
151151
expected = DataFrame({"a": [np.nan, 2], "b": ["x", np.nan]})

pandas/tests/frame/indexing/test_setitem.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,9 @@ def test_setitem_other_callable(self):
987987
def inc(x):
988988
return x + 1
989989

990-
df = DataFrame([[-1, 1], [1, -1]])
990+
# Set dtype object straight away to avoid upcast when setting
991+
# inc below
992+
df = DataFrame([[-1, 1], [1, -1]], dtype=object)
991993
df[df > 0] = inc
992994

993995
expected = DataFrame([[-1, inc], [inc, -1]])

pandas/tests/frame/methods/test_asof.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def test_missing(self, date_range_frame):
7979
# GH 15118
8080
# no match found - `where` value before earliest date in index
8181
N = 10
82-
df = date_range_frame.iloc[:N].copy()
82+
# Cast to 'float64' to avoid upcast when introducing nan in df.asof
83+
df = date_range_frame.iloc[:N].copy().astype("float64")
8384

8485
result = df.asof("1989-12-31")
8586

0 commit comments

Comments
 (0)