File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
pandas/tests/groupby/aggregate Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -338,13 +338,11 @@ def test_cython_agg_nullable_int(op_name):
338
338
result = getattr (df .groupby ("A" )["B" ], op_name )()
339
339
df2 = df .assign (B = df ["B" ].astype ("float64" ))
340
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" )
341
+ if op_name in ("mean" , "median" ):
342
+ convert_integer = False
346
343
else :
347
- result = result .astype ("int64" )
344
+ convert_integer = True
345
+ expected = expected .convert_dtypes (convert_integer = convert_integer )
348
346
tm .assert_series_equal (result , expected )
349
347
350
348
You can’t perform that action at this time.
0 commit comments