8000 Merge pull request #9139 from ahaldane/print_no_leading_space · numpy/numpy@d8be978 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8be978

Browse files
authored
Merge pull request #9139 from ahaldane/print_no_leading_space
ENH: remove unneeded spaces in float/bool reprs, fixes 0d str
2 parents ceef499 + 710e032 commit d8be978

File tree

6 files changed

+321
-217
lines changed

6 files changed

+321
-217
lines changed

doc/release/1.14.0-notes.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,23 @@ source to the destination.
304304
Using field "titles" in multiple-field indexing is now disallowed, as is
305305
repeating a field name in a multiple-field index.
306306

307+
``sign`` option added to ``np.setprintoptions`` and ``np.array2string``
308+
-----------------------------------------------------------------------
309+
This option controls printing of the sign of floating-point types, and may be
310+
one of the characters '-', '+' or ' ', or the string 'legacy'. With '+' numpy
311+
always prints the sign of positive values, with ' ' it always prints a space
312+
(whitespace character) in the sign position of positive values, and with '-' it
313+
will omit the sign character for positive values, and with 'legacy' it will
314+
behave like ' ' except no space is printed in 0d arrays. The new default is '-'.
315+
316+
Unneeded whitespace in float array printing removed
317+
---------------------------------------------------
318+
The new default of ``sign='-'`` (see last note) means that the ``repr`` of
319+
float arrays now often omits the whitespace characters previously used to
320+
display the sign. This new behavior can be disabled to mostly reproduce numpy
321+
1.13 behavior by calling ``np.set_printoptions(sign='legacy')``.
322+
323+
``threshold`` and ``edgeitems`` options added to ``np.array2string``
324+
-----------------------------------------------------------------
325+
These options could previously be controlled using ``np.set_printoptions``, but
326+
now can be changed on a per-call basis as arguments to ``np.array2string``.

0 commit comments

Comments
 (0)
0