Skip to content

Commit 3f15670

Browse files
author
MarcoGorelli
committed
fixup test_function
1 parent 1cc3f50 commit 3f15670

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/tests/groupby/test_function.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,8 @@ def test_cummin(dtypes_for_minmax):
826826
tm.assert_frame_equal(result, expected, check_exact=True)
827827

828828
# Test nan in some values
829+
# Explicit cast to float to avoid implicit cast when setting nan
830+
base_df = base_df.astype({"B": "float"})
829831
base_df.loc[[0, 2, 4, 6], "B"] = np.nan
830832
expected = DataFrame({"B": [np.nan, 4, np.nan, 2, np.nan, 3, np.nan, 1]})
831833
result = base_df.groupby("A").cummin()
@@ -891,6 +893,8 @@ def test_cummax(dtypes_for_minmax):
891893
tm.assert_frame_equal(result, expected)
892894

893895
# Test nan in some values
896+
# Explicit cast to float to avoid implicit cast when setting nan
897+
base_df = base_df.astype({"B": "float"})
894898
base_df.loc[[0, 2, 4, 6], "B"] = np.nan
895899
expected = DataFrame({"B": [np.nan, 4, np.nan, 4, np.nan, 3, np.nan, 3]})
896900
result = base_df.groupby("A").cummax()

0 commit comments

Comments
 (0)