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

Masked arrays and apply_over_axes #4461

Closed
bensondaled opened this issue Mar 8, 2014 · 1 comment · Fixed by #4463
Closed

Masked arrays and apply_over_axes #4461

bensondaled opened this issue Mar 8, 2014 · 1 comment · Fixed by #4463

Comments

@bensondaled
Copy link

Cannot get apply_over_axes to work on masked arrays. Have tried both np.apply_over_axes and np.ma.apply_over_axes.

x = np.array([1,2,3])
x = np.masked_where(x==3, x)
np.ma.apply_over_axes(np.ma.mean, x, axes=(0))

array([ 2. ])

This should be 1.5. Have tried all combinations of np.ma and regular np functions. Can't get it to work. (Obviously the example given does not require apply_over_axes, but used it for simplicity.)

Using numpy version 1.8

@abalkin
Copy link
Contributor

abalkin commented Mar 9, 2014

Interestingly, the test for this case was already partially there, but the control was incorrect and assert not there.

abalkin added a commit to abalkin/numpy that referenced this issue Apr 2, 2014
Masked arrays version of apply_over_axes did not apply
function correctly to arrays with non-trivial masks.

Fixes numpy#4461.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants