Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v2.1.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Fixed regressions

Bug fixes
~~~~~~~~~
-
- Bug in :meth:`DataFrame.apply` where passing ``raw=True`` ignored ``args`` passed to the applied function (:issue:`55753`)
-

.. ---------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,9 @@ def wrapper(*args, **kwargs):

return wrapper

result = np.apply_along_axis(wrap_function(self.func), self.axis, self.values)
result = np.apply_along_axis(
wrap_function(self.func), self.axis, self.values, *self.args, **self.kwargs
)

# TODO: mixed type case
if result.ndim == 2:
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/apply/test_frame_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def test_apply(float_frame):


@pytest.mark.parametrize("axis", [0, 1])
def test_apply_args(float_frame, axis):
result = float_frame.apply(lambda x, y: x + y, axis, args=(1,))
@pytest.mark.parametrize("raw", [True, False])
def test_apply_args(float_frame, axis, raw):
result = float_frame.apply(lambda x, y: x + y, axis, args=(1,), raw=raw)
expected = float_frame + 1
tm.assert_frame_equal(result, expected)

Expand Down