Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align DataFrame.apply signature with pandas #9275

Merged
Merged
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
17 changes: 15 additions & 2 deletions python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4742,7 +4742,9 @@ def query(self, expr, local_dict=None):
boolmask = queryutils.query_execute(self, expr, callenv)
return self._apply_boolean_mask(boolmask)

def apply(self, func, axis=1):
def apply(
self, func, axis=1, raw=False, result_type=None, args=(), **kwargs
):
"""
Apply a function along an axis of the DataFrame.

Expand All @@ -4756,12 +4758,17 @@ def apply(self, func, axis=1):
----------
func : function
Function to apply to each row.

axis : {0 or 'index', 1 or 'columns'}, default 0
Axis along which the function is applied:
* 0 or 'index': apply function to each column.
Note: axis=0 is not yet supported.
* 1 or 'columns': apply function to each row.
raw: bool, default False
Not yet supported
result_type: {'expand', 'reduce', 'broadcast', None}, default None
Not yet supported
args: tuple
Not yet supported

Examples
--------
Expand Down Expand Up @@ -4910,6 +4917,12 @@ def apply(self, func, axis=1):
raise ValueError(
"DataFrame.apply currently only supports row wise ops"
)
if raw:
raise ValueError("The `raw` kwarg is not yet supported.")
if result_type is not None:
raise ValueError("The `result_type` kwarg is not yet supported.")
if args or kwargs:
raise ValueError("args and kwargs are not yet supported.")

return cudf.Series(func(self))

Expand Down