diff options
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index cbe95f51b..7dc73d6de 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -471,14 +471,15 @@ def _array2string(a, options, separator=' ', prefix=""): # The formatter __init__s in _get_format_function cannot deal with # subclasses yet, and we also need to avoid recursion issues in # _formatArray with subclasses which return 0d arrays in place of scalars - a = asarray(a) + data = asarray(a) + if a.shape == (): + a = data if a.size > options['threshold']: summary_insert = "..." - data = _leading_trailing(a, options['edgeitems']) + data = _leading_trailing(data, options['edgeitems']) else: summary_insert = "" - data = a # find the right formatting function for the array format_function = _get_format_function(data, **options) |