Skip to content

Commit 3384b83

Browse files
throw when frame apply is given invalid axis+func
1 parent 39bd3d3 commit 3384b83

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pandas/core/apply.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,20 @@ def frame_apply(
9090
kwargs=None,
9191
) -> FrameApply:
9292
"""construct and return a row or column based frame apply object"""
93+
_, func, columns, _ = reconstruct_func(func, **kwargs)
94+
9395
axis = obj._get_axis_number(axis)
9496
klass: type[FrameApply]
9597
if axis == 0:
9698
klass = FrameRowApply
9799
elif axis == 1:
100+
if columns:
101+
raise NotImplementedError(
102+
"func given to frame_apply cannot contain "
103+
"an index relabeling when axis is 1"
104+
)
98105
klass = FrameColumnApply
99106

100-
_, func, _, _ = reconstruct_func(func, **kwargs)
101-
assert func is not None
102-
103107
return klass(
104108
obj,
105109
func,

0 commit comments

Comments
 (0)