File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3257,6 +3257,27 @@ def test_groupby_count_return_arrow_dtype(data_missing):
3257
3257
tm .assert_frame_equal (result , expected )
3258
3258
3259
3259
3260
+ @pytest .mark .parametrize (
3261
+ "func, func_dtype" ,
3262
+ [
3263
+ [lambda x : x .to_dict (), "object" ],
3264
+ [lambda x : 1 , "int64" ],
3265
+ [lambda x : "s" , ArrowDtype (pa .string ())],
3266
+ ],
3267
+ )
3268
+ def test_groupby_aggregate_coersion (func , func_dtype ):
3269
+ # GH 61636
3270
+ df = pd .DataFrame (
3271
+ {
3272
+ "b" : pd .array ([0 , 1 ]),
3273
+ "c" : pd .array (["X" , "Y" ], dtype = ArrowDtype (pa .string ())),
3274
+ },
3275
+ index = pd .Index (["A" , "B" ], name = "a" ),
3276
+ )
3277
+ result = df .groupby ("b" ).agg (func )
3278
+ assert result ["c" ].dtype == func_dtype
3279
+
3280
+
3260
3281
def test_fixed_size_list ():
3261
3282
# GH#55000
3262
3283
ser = pd .Series (
You can’t perform that action at this time.
0 commit comments