-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fix reducing numpy ufuncs for Series/Index #23314
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: fix reducing numpy ufuncs for Series/Index #23314
Conversation
Hello @jorisvandenbossche! Thanks for submitting the PR.
|
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.
needs a whatsnew note
@@ -833,6 +833,15 @@ def test_ufunc_coercions(self, holder): | |||
exp = tm.box_expected(exp, box) | |||
tm.assert_equal(result, exp) | |||
|
|||
@pytest.mark.parametrize('holder', [pd.Int64Index, pd.UInt64Index, |
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.
holder -> box
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.
The tests above also use holder, so I wanted to be consistent, but can change them all
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.
yes, we have settled on box a while back
def test_ufunc_reduce(self, holder): | ||
idx = holder([1, 2, 3, 4, 5], name='x') | ||
|
||
result = np.add.reduce(idx) |
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.
use paramterize over some more ops 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.
We would only be testing that those work on the underlying numpy array (which they do :)), so I don't think it is that important
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.
well can't hurt to have a few more then
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 might be more useful is with other result types, like np.logical_and.reduce
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.
yes exactly
Codecov Report
@@ Coverage Diff @@
## master #23314 +/- ##
==========================================
+ Coverage 92.22% 92.22% +<.01%
==========================================
Files 169 169
Lines 51258 51263 +5
==========================================
+ Hits 47274 47279 +5
Misses 3984 3984
Continue to review full report at Codecov.
|
needs a rebase |
@jorisvandenbossche can you merge master and update |
can you merge master (and move notes to 0.25) / or close if going to handle in |
closes #23312