-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/ENH: Fix apply to only call func
once on the first column/row
#34183
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
Conversation
Hope to get this will be merged instead of #33880 There are couple of points i am not sure of, and would like to discuss before wrapping it up completely. they are also pointed in comments to the code
|
func
once on the first column/rowfunc
once on the first column/row
as this actually solves also the case for #31695, i can add the doc change (the PR for this issue seems a bit stuck) |
4bf1742
to
8c366be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are claiming 3 issues closed. please put up a test for each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs testing & likely change reduction
#31111 wasn't fixed by me. |
ce0e124
to
40646e2
Compare
Hey guys, waiting for your review of how i fixed your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok looks pretty good. can you add a whatsnew note; this needs an actual section in api breaking (for visibility); you can look back at the groupby apply change and use a similar format here
pandas/core/apply.py
Outdated
# no exceptions - however reduction was unsuccessful, | ||
# use the computed function result for first element | ||
partial_result = result[0] | ||
if isinstance(partial_result, ABCSeries): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually remove this as its an api change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not averse but that would be a separate change; I think we have an issue below about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This object inference was added as without it test_replace_method
fails.
@jreback thanks for the review! Important to say that this solution is not complete, i have not solved the case for I will try to spend a bit more time on that, However i won't have much time in the near future, |
4196103
to
fa6299d
Compare
@jreback i fixed/asked a question regarding all issues, I don't believe i will have time to fix the problem in |
can u add a test that shows this case and xfail it; also pls open an issue for this case |
86429a5
to
2cd8ee6
Compare
@jreback There are 3 open conversations for which i answered reviewers questions and i am waiting for a reviewer to close them/ decide if we need to change code/ open an issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls update the docs as shown, ping on green.
assert names == list(df.index) | ||
|
||
@pytest.mark.xfail( | ||
reason="The 'run once' enhancement for apply_raw not implemented yet." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the issue number you create here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its listed in comment in the first row of test function,
You want it also in the reason
?
@jreback green! |
thanks @alonme very nice & very responsive! |
closes #33879
closes #30815
closes #31620
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff