We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c9a8f95 commit 317290aCopy full SHA for 317290a
pandas/tests/groupby/aggregate/test_cython.py
@@ -338,13 +338,11 @@ def test_cython_agg_nullable_int(op_name):
338
result = getattr(df.groupby("A")["B"], op_name)()
339
df2 = df.assign(B=df["B"].astype("float64"))
340
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")
+ if op_name in ("mean", "median"):
+ convert_integer = False
346
else:
347
- result = result.astype("int64")
+ convert_integer = True
+ expected = expected.convert_dtypes(convert_integer=convert_integer)
348
tm.assert_series_equal(result, expected)
349
350
0 commit comments