Skip to content

Commit d0de3f1

Browse files
author
MarcoGorelli
committed
fixup test_multi;
1 parent 3f15670 commit d0de3f1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pandas/tests/reshape/merge/test_multi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def run_asserts(left, right, sort):
123123

124124
lc = list(map(chr, np.arange(ord("a"), ord("z") + 1)))
125125
left = DataFrame(np.random.choice(lc, (5000, 2)), columns=["1st", "3rd"])
126-
left.insert(1, "2nd", np.random.randint(0, 1000, len(left)))
126+
# Explicit cast to float to avoid implicit cast when setting nan
127+
left.insert(1, "2nd", np.random.randint(0, 1000, len(left)).astype("float"))
127128

128129
i = np.random.permutation(len(left))
129130
right = left.iloc[i].copy()

pandas/tests/window/test_rolling.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,10 @@ def test_closed_uneven():
432432
)
433433
def test_closed_min_max_minp(func, closed, expected):
434434
# see gh-21704
435-
ser = Series(data=np.arange(10), index=date_range("2000", periods=10))
435+
# Explicit cast to float to avoid implicit cast when setting nan
436+
ser = Series(
437+
data=np.arange(10), index=date_range("2000", periods=10), dtype="float"
438+
)
436439
ser[ser.index[-3:]] = np.nan
437440
result = getattr(ser.rolling("3D", min_periods=2, closed=closed), func)()
438441
expected = Series(expected, index=ser.index)

0 commit comments

Comments
 (0)