Skip to content

Commit 78c133a

Browse files
committed
fix issues
1 parent ff7c64b commit 78c133a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas/core/apply.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ def agg_or_apply_list_like(
323323

324324
is_groupby = isinstance(obj, (DataFrameGroupBy, SeriesGroupBy))
325325

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-
329326
context_manager: ContextManager
330327
if is_groupby:
331328
# When as_index=False, we combine all results using indices
@@ -344,7 +341,8 @@ def include_axis(colg) -> bool:
344341
if selected_obj.ndim == 1:
345342
for a in func:
346343
colg = obj._gotitem(selected_obj.name, ndim=1, subset=selected_obj)
347-
new_res = getattr(colg, op_name)(a, *this_args, **kwargs)
344+
args = [self.axis, *self.args] if include_axis(colg) else self.args
345+
new_res = getattr(colg, op_name)(a, *args, **kwargs)
348346
results.append(new_res)
349347

350348
# make sure we find a good name
@@ -355,7 +353,8 @@ def include_axis(colg) -> bool:
355353
indices = []
356354
for index, col in enumerate(selected_obj):
357355
colg = obj._gotitem(col, ndim=1, subset=selected_obj.iloc[:, index])
358-
new_res = getattr(colg, op_name)(func, *this_args, **kwargs)
356+
args = [self.axis, *self.args] if include_axis(colg) else self.args
357+
new_res = getattr(colg, op_name)(func, *args, **kwargs)
359358
results.append(new_res)
360359
indices.append(index)
361360
keys = selected_obj.columns.take(indices)

0 commit comments

Comments
 (0)