Skip to content

Commit 317290a

Browse files
authored
TST: Don't cast in test_cython_agg_nullable_int (#54248)
1 parent c9a8f95 commit 317290a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pandas/tests/groupby/aggregate/test_cython.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,11 @@ def test_cython_agg_nullable_int(op_name):
338338
result = getattr(df.groupby("A")["B"], op_name)()
339339
df2 = df.assign(B=df["B"].astype("float64"))
340340
expected = getattr(df2.groupby("A")["B"], op_name)()
341-
342-
if op_name != "count":
343-
# the result is not yet consistently using Int64/Float64 dtype,
344-
# so for now just checking the values by casting to float
345-
result = result.astype("float64")
341+
if op_name in ("mean", "median"):
342+
convert_integer = False
346343
else:
347-
result = result.astype("int64")
344+
convert_integer = True
345+
expected = expected.convert_dtypes(convert_integer=convert_integer)
348346
tm.assert_series_equal(result, expected)
349347

350348

0 commit comments

Comments
 (0)