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

Support args= in apply #9514

Merged
merged 7 commits into from
Nov 4, 2021

Conversation

brandon-b-miller
Copy link
Contributor

@brandon-b-miller brandon-b-miller commented Oct 25, 2021

Closes #9500

Allows passing args= to DataFrame.apply as is supported in pandas: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.apply.html

Concretely, this allows for this:

import cudf
df = cudf.DataFrame({
    'a':[1,2,3]
})

def f(row, c):
    return row['a'] + c

res = df.apply(f, args=(3,))

cc @randerzander

@brandon-b-miller brandon-b-miller added feature request New feature or request 2 - In Progress Currently a work in progress numba Numba issue Python Affects Python cuDF API. non-breaking Non-breaking change labels Oct 25, 2021
@brandon-b-miller brandon-b-miller self-assigned this Oct 25, 2021
@brandon-b-miller brandon-b-miller marked this pull request as ready for review October 26, 2021 12:26
@brandon-b-miller brandon-b-miller requested a review from a team as a code owner October 26, 2021 12:26
@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #9514 (368b54d) into branch-21.12 (ab4bfaa) will decrease coverage by 0.14%.
The diff coverage is n/a.

❗ Current head 368b54d differs from pull request most recent head 354730c. Consider uploading reports for the commit 354730c to get more accurate results
Impacted file tree graph

@@               Coverage Diff                @@
##           branch-21.12    #9514      +/-   ##
================================================
- Coverage         10.79%   10.64%   -0.15%     
================================================
  Files               116      117       +1     
  Lines             18869    19342     +473     
================================================
+ Hits               2036     2059      +23     
- Misses            16833    17283     +450     
Impacted Files Coverage Δ
python/dask_cudf/dask_cudf/sorting.py 92.90% <0.00%> (-1.21%) ⬇️
python/cudf/cudf/io/csv.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/orc.py 0.00% <0.00%> (ø)
python/cudf/cudf/__init__.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/frame.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/index.py 0.00% <0.00%> (ø)
python/cudf/cudf/io/parquet.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/series.py 0.00% <0.00%> (ø)
python/cudf/cudf/core/reshape.py 0.00% <0.00%> (ø)
python/cudf/cudf/utils/dtypes.py 0.00% <0.00%> (ø)
... and 42 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90dd9fe...354730c. Read the comment docs.

@brandon-b-miller
Copy link
Contributor Author

rerun tests

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great that numba makes it easy to handle this so elegantly.

python/cudf/cudf/core/udf/pipeline.py Outdated Show resolved Hide resolved
@vyasr vyasr removed the request for review from marlenezw October 29, 2021 00:02
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brandon-b-miller brandon-b-miller added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 2 - In Progress Currently a work in progress labels Nov 4, 2021
@brandon-b-miller
Copy link
Contributor Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit f041a47 into rapidsai:branch-21.12 Nov 4, 2021
@brandon-b-miller
Copy link
Contributor Author

Opened #9598 for the Series follow up that I was not able to easily implement here and should be tackled separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge feature request New feature or request non-breaking Non-breaking change numba Numba issue Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Support passing scalar args to df.apply
2 participants