Conversation
|
This can be triggered even without the user passing |
|
I'm working on a fix |
|
I've attached a fix! |
keepdims=True fails on masked_arraykeepdims=True fails on masked_array
There was a problem hiding this comment.
Lots of PEP8 violations in this function (spaces after commas) -- could you fix that? Otherwise LGTM
There was a problem hiding this comment.
Oops, thanks for pointing that out - should be fixed now
…eepdims= keyword argument, and include regression test
8fbf36e to
644865f
Compare
|
Before you work too hard on this, may I suggest looking at my PR #5706, which adds keepdims, and is finished but just waiting for a review. After a huge discussion, we concluded you can't directly add a |
|
@ahaldane: oh good point |
|
Just to clarify, this is causing test failures in Astropy, so it would be good to have this fix included in 1.11.0 final - thanks! |
|
@astrofrog: wait, this is a regression? Can you give an example of code that used to work but now doesn't, and which version it worked in? |
|
@njsmith - it is a regression but actually after double checking I think it doesn't affect 1.11.0 pre-releases. This works in Numpy 1.9, 1.10, and 1.11.0rc1 (using the git tag): but fails in master: So maybe we are ok for the 1.11.0 release |
|
We recently put in a PR fixing keepdims propagation to subclasses for things like sum. That probably is the reason. Which means that |
|
Ohh, yes, I never looked at this a lot. The issue here is not so much the lack of keepdims in MA as much as the use of keepdims in nanvar, etc. |
|
Tagging with 1.12 milestone, just so we revisit it before a release. |
|
☔ The latest upstream changes (presumably #5706) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@ahaldane was this fixed? |
|
Yeah this is fixed. Closing. |
When calling
np.sumon a masked array, and using thekeepdimsoption, an error is raised: