Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BUG: _can_use_numexpr fails when passed large Series #27773
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
BUG: _can_use_numexpr fails when passed large Series #27773
Changes from all commits
1a23578
6d212c7
e16e893
0100aba
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What does this do?
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.
There is an overhead in using numexpr for computations that makes it not worth using for a low number of computations. The values of this defaults to: 10,000. In this test suite we are trying to verify that numexpr is being invoked correctly however the function _can_use_numexpr checks that the objects operated on are sufficient size:
We can therefore run the test suite exclusively on objects where the number of elements > 10,000 or set the min elements to zero to always try and use numexpr.
This is what is meant by a "large DataFrame". Anything where the size of the objects is large enough to warrant using numexpr fails because of the regression, anything that is smaller than the threshold will succeed because numexpr evaluation will not even be considered.
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.
Hmm is affecting global state, right? I worry about this leaking into other tests...
Can you use the
monkeypatch
fixture, and do this setting with (IIRC)monkeypatch.setattr
? That way it'll be undone when the test exits.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.
It is but this is handled in the test classes teardown method on line 57 so the global state won't be affected permanently. I can move my test out of the class and handle this with monkeypatch or we can keep the setup/teardown framework already implemented in the TestExpressions class.
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.
Thanks, I wasn't familiar with these tests.