summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-09-25 01:13:19 -0700
committerEric Wieser <wieser.eric@gmail.com>2017-09-25 09:20:33 -0700
commit91b83ac6a9477bfb469e270b6e8634b597a3d1ac (patch)
treefe900d8a421221419426945054cd707376576f1c /numpy/ma/core.py
parent366b14c312aaaa983ad2345fd0c4165e159de475 (diff)
downloadnumpy-91b83ac6a9477bfb469e270b6e8634b597a3d1ac.tar.gz
MAINT: Remove special casing of 0d in MaskedArray.__str__
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py27
1 files changed, 5 insertions, 22 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index bee2911d7..de72d2080 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3827,30 +3827,13 @@ class MaskedArray(ndarray):
"""
if masked_print_option.enabled():
- f = masked_print_option
- if self is masked:
- return str(f)
- m = self._mask
- if m is nomask:
+ mask = self._mask
+ if mask is nomask:
res = self._data
else:
- if m.shape == () and m.itemsize==len(m.dtype):
- if m.dtype.names:
- m = m.view((bool, len(m.dtype)))
- if m.any():
- return str(tuple((f if _m else _d) for _d, _m in
- zip(self._data.tolist(), m)))
- else:
- return str(self._data)
- elif m:
- return str(f)
- else:
- return str(self._data)
# convert to object array to make filled work
- names = self.dtype.names
- if names is None:
+ if self.dtype.names is None:
data = self._data
- mask = m
# For big arrays, to avoid a costly conversion to the
# object dtype, extract the corners before the conversion.
print_width = (self._print_width if self.ndim > 1
@@ -3863,11 +3846,11 @@ class MaskedArray(ndarray):
arr = np.split(mask, (ind, -ind), axis=axis)
mask = np.concatenate((arr[0], arr[2]), axis=axis)
res = data.astype("O")
- res.view(ndarray)[mask] = f
+ res.view(ndarray)[mask] = masked_print_option
else:
rdtype = _replace_dtype_fields(self.dtype, "O")
res = self._data.astype(rdtype)
- _recursive_printoption(res, m, f)
+ _recursive_printoption(res, mask, masked_print_option)
else:
res = self.filled(self.fill_value)
return str(res)