summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorMike Lui <mike.d.lui@gmail.com>2019-04-25 22:11:47 -0400
committerMike Lui <mike.d.lui@gmail.com>2019-04-25 22:11:47 -0400
commit247cbb8ed8a925349eb1d2b12809493488c4d5c5 (patch)
tree477aa478d67605d5ed7673034cf64b12cd8c3a51 /numpy/core/arrayprint.py
parent9218e593d05c1231a8b2c72d47967e02099070ae (diff)
downloadnumpy-247cbb8ed8a925349eb1d2b12809493488c4d5c5.tar.gz
DOC: clarify array_{2string,str,repr} defaults
Point documentation on default values for array2string, array_str, and array_repr to set_printoptions. set_printoptions uses the same defaulting scheme.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index 7d8785c32..4d9ec954c 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -163,7 +163,8 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None,
- 'str_kind' : sets 'str' and 'numpystr'
floatmode : str, optional
Controls the interpretation of the `precision` option for
- floating-point types. Can take the following values:
+ floating-point types. Can take the following values
+ (default maxprec_equal):
* 'fixed': Always print exactly `precision` fractional digits,
even if this would print more or fewer digits than
@@ -532,14 +533,16 @@ def array2string(a, max_line_width=None, precision=None,
max_line_width : int, optional
The maximum number of columns the string should span. Newline
characters splits the string appropriately after array elements.
+ See `linewidth` in `set_printoptions` for defaults.
precision : int or None, optional
- Floating point precision. Default is the current printing
- precision (usually 8), which can be altered using `set_printoptions`.
+ Floating point precision. Default is the current printing precision
+ (usually 8), which can be altered using `set_printoptions`.
suppress_small : bool, optional
Represent very small numbers as zero. A number is "very small" if it
is smaller than the current printing precision.
+ See `suppress` in `set_printoptions` for defaults.
separator : str, optional
- Inserted between elements.
+ Inserted between elements (default ' ').
prefix : str, optional
suffix: str, optional
The length of the prefix and suffix strings are used to respectively
@@ -584,17 +587,21 @@ def array2string(a, max_line_width=None, precision=None,
threshold : int, optional
Total number of array elements which trigger summarization
rather than full repr.
+ See `set_printoptions` for defaults.
edgeitems : int, optional
Number of array items in summary at beginning and end of
each dimension.
+ See `set_printoptions` for defaults.
sign : string, either '-', '+', or ' ', optional
Controls printing of the sign of floating-point types. If '+', always
print the sign of positive values. If ' ', always prints a space
(whitespace character) in the sign position of positive values. If
'-', omit the sign character of positive values.
+ See `set_printoptions` for defaults.
floatmode : str, optional
Controls the interpretation of the `precision` option for
- floating-point types. Can take the following values:
+ floating-point types. See `set_printoptions` for defaults.
+ Can take the following values:
- 'fixed': Always print exactly `precision` fractional digits,
even if this would print more or fewer digits than
@@ -1460,6 +1467,7 @@ def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):
max_line_width : int, optional
The maximum number of columns the string should span. Newline
characters split the string appropriately after array elements.
+ See `linewidth` in `set_printoptions` for defaults.
precision : int, optional
Floating point precision. Default is the current printing precision
(usually 8), which can be altered using `set_printoptions`.
@@ -1467,6 +1475,7 @@ def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):
Represent very small numbers as zero, default is False. Very small
is defined by `precision`, if the precision is 8 then
numbers smaller than 5e-9 are represented as zero.
+ See `suppress` in `set_printoptions` for defaults.
Returns
-------
@@ -1537,16 +1546,16 @@ def array_str(a, max_line_width=None, precision=None, suppress_small=None):
a : ndarray
Input array.
max_line_width : int, optional
- Inserts newlines if text is longer than `max_line_width`. The
- default is, indirectly, 75.
+ Inserts newlines if text is longer than `max_line_width`.
+ See `linewidth` in `set_printoptions` for defaults.
precision : int, optional
- Floating point precision. Default is the current printing precision
+ Floating point precision. Default is the current printing precision
(usually 8), which can be altered using `set_printoptions`.
suppress_small : bool, optional
Represent numbers "very close" to zero as zero; default is False.
Very close is defined by precision: if the precision is 8, e.g.,
numbers smaller (in absolute value) than 5e-9 are represented as
- zero.
+ zero. See `suppress` in `set_printoptions` for defaults.
See Also
--------