summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 8dc2ca86e..42787e3c7 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3976,21 +3976,16 @@ class MaskedArray(ndarray):
"""
m = self._mask
s = self.shape
- ls = len(s)
if m is nomask:
- if ls == 0:
- return 1
- if ls == 1:
- return s[0]
if axis is None:
return self.size
else:
n = s[axis]
t = list(s)
del t[axis]
- return np.ones(t) * n
+ return np.full(t, n, dtype=np.intp)
n1 = np.size(m, axis)
- n2 = m.astype(int).sum(axis)
+ n2 = np.sum(m, axis=axis, dtype=np.intp)
if axis is None:
return (n1 - n2)
else: