-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels