diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/arrayprint.py | 4 | ||||
-rw-r--r-- | numpy/core/numeric.py | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 0786b2904..fcda825c7 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -583,7 +583,9 @@ class FloatFormat(object): import numeric as _nc err = _nc.seterr(invalid='ignore') try: - if isnan(x): + if isna(x): + return str(x) + elif isnan(x): if self.sign: return self.special_fmt % ('+' + _nan_str,) else: diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index f74b2548c..e073128dd 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1324,14 +1324,22 @@ def array_repr(arr, max_line_width=None, precision=None, suppress_small=None): ', ', "array(") else: # show zero-length shape unless it is (0,) lst = "[], shape=%s" % (repr(arr.shape),) - typeless = arr.dtype.type in _typelessdata if arr.__class__ is not ndarray: cName= arr.__class__.__name__ else: cName = "array" - if typeless and arr.size: - return cName + "(%s)" % lst + + skiptype = (arr.dtype.type in _typelessdata) and arr.size > 0 + + if arr.flags.maskna: + lst += ", maskna=True" + # If everything is NA, can't skip the type + if np.all(np.isna(arr)): + skiptype = False + + if skiptype: + return "%s(%s)" % (cName, lst) else: typename = arr.dtype.name # Quote typename in the output if it is "complex". |