summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index f1e6b2da9..9b7c20d76 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -1336,9 +1336,12 @@ def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):
skipdtype = (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 skipdtype and all(isna(arr)):
+ whichna = isna(arr)
+ # If nothing is NA, explicitly signal the NA-mask
+ if not any(whichna):
+ lst += ", maskna=True"
+ # If everything is NA, can't skip the dtype
+ if skipdtype and all(whichna):
skipdtype = False
if skipdtype: