@@ -325,6 +325,8 @@ def agg_list_like(self) -> DataFrame | Series:
325
325
326
326
is_groupby = isinstance (obj , (DataFrameGroupBy , SeriesGroupBy ))
327
327
is_ser_or_df = isinstance (obj , (ABCDataFrame , ABCSeries ))
328
+ this_args = [self .axis , * self .args ] if is_ser_or_df else self .args
329
+
328
330
context_manager : ContextManager
329
331
if is_groupby :
330
332
# When as_index=False, we combine all results using indices
@@ -337,7 +339,6 @@ def agg_list_like(self) -> DataFrame | Series:
337
339
if selected_obj .ndim == 1 :
338
340
for a in arg :
339
341
colg = obj ._gotitem (selected_obj .name , ndim = 1 , subset = selected_obj )
340
- this_args = [self .axis , * self .args ] if is_ser_or_df else self .args
341
342
new_res = colg .aggregate (a , * this_args , ** self .kwargs )
342
343
results .append (new_res )
343
344
@@ -349,7 +350,6 @@ def agg_list_like(self) -> DataFrame | Series:
349
350
indices = []
350
351
for index , col in enumerate (selected_obj ):
351
352
colg = obj ._gotitem (col , ndim = 1 , subset = selected_obj .iloc [:, index ])
352
- this_args = [self .axis , * self .args ] if is_ser_or_df else self .args
353
353
new_res = colg .aggregate (arg , * this_args , ** self .kwargs )
354
354
results .append (new_res )
355
355
indices .append (index )
0 commit comments