@@ -324,6 +324,8 @@ def agg_or_apply_list_like(
324
324
is_groupby = isinstance (obj , (DataFrameGroupBy , SeriesGroupBy ))
325
325
326
326
is_ser_or_df = isinstance (obj , (ABCDataFrame , ABCSeries ))
327
+ this_args = [self .axis , * self .args ] if is_ser_or_df else self .args
328
+
327
329
context_manager : ContextManager
328
330
if is_groupby :
329
331
# When as_index=False, we combine all results using indices
@@ -342,7 +344,6 @@ def include_axis(colg) -> bool:
342
344
if selected_obj .ndim == 1 :
343
345
for a in func :
344
346
colg = obj ._gotitem (selected_obj .name , ndim = 1 , subset = selected_obj )
345
- this_args = [self .axis , * self .args ] if is_ser_or_df else self .args
346
347
new_res = getattr (colg , op_name )(a , * this_args , ** kwargs )
347
348
results .append (new_res )
348
349
@@ -354,7 +355,6 @@ def include_axis(colg) -> bool:
354
355
indices = []
355
356
for index , col in enumerate (selected_obj ):
356
357
colg = obj ._gotitem (col , ndim = 1 , subset = selected_obj .iloc [:, index ])
357
- this_args = [self .axis , * self .args ] if is_ser_or_df else self .args
358
358
new_res = getattr (colg , op_name )(func , * this_args , ** kwargs )
359
359
results .append (new_res )
360
360
indices .append (index )
0 commit comments