8000 numpy.ma - some statistics operators do not accept tuple axis arguments · Issue #8047 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

numpy.ma - some statistics operators do not accept tuple axis arguments #8047

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

Closed
mwtoews opened this issue Sep 12, 2016 · 1 comment
Closed

Comments

@mwtoews
Copy link
Contributor
mwtoews commented Sep 12, 2016

This is essentially a re-opening of #6844 with examples:

import numpy as np
print(np.__version__)  # 1.11.1
x = np.ma.arange(24)
x.shape = (4, 3, 2)
# e.g. this works
print(np.ma.mean(x, axis=(0,1)))  # [11.0 12.0]
# but it doesn't work with a mask array set
x.mask = x.data > 12

Testing with version 1.11.1, here are the methods that raise TypeError: tuple indices must be integers, not tuple:

  • np.ma.mean(x, axis=(0,1))
  • np.ma.std(x, axis=(0, 1))
  • np.ma.var(x, axis=(0, 1))

This raises a variation TypeError: an integer is required for the axis:

  • np.ma.median(x, axis=(0, 1))

And these methods appear to work, returning a masked array result:

  • np.ma.min(x, axis=(0, 1)) # [0 1]
  • np.ma.max(x, axis=(0, 1)) # [12 11]
  • np.ma.sum(x, axis=(0, 1)) # [42 36]

(are there other operators with a mask= argument?)

I get the same results with NumPy 1.11.1 with Python 2.7 on Windows and Linux.

@seberg
Copy link
Member
seberg commented Sep 12, 2016

These things all work on master, so this seems already fixed.

@seberg seberg closed this as completed Sep 12, 2016
jotasi pushed a commit to jotasi/numpy that referenced this issue Dec 21, 2016
jotasi pushed a commit to jotasi/numpy that referenced this issue Dec 21, 2016
BUG: fix MANIFEST.in for removal of a file in numpygh-8047.
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

No branches or pull requests

2 participants
0