summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorMike Lui <mike.d.lui@gmail.com>2019-04-25 23:36:32 -0400
committerMike Lui <mike.d.lui@gmail.com>2019-04-25 23:36:32 -0400
commitc9641f84a5fd77841e0d70c062a9457bd9e12e75 (patch)
tree579fa1ab77c90b5d9474d101a2a7e6eacc4760ec /numpy/core/arrayprint.py
parent247cbb8ed8a925349eb1d2b12809493488c4d5c5 (diff)
downloadnumpy-c9641f84a5fd77841e0d70c062a9457bd9e12e75.tar.gz
DOC: clarify array_{2string,str,repr} defaults
Point users to get_printoptions(), which returns the current print defaults.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py55
1 files changed, 29 insertions, 26 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index 4d9ec954c..3e8cdf6ab 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -531,18 +531,19 @@ def array2string(a, max_line_width=None, precision=None,
a : array_like
Input array.
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.
+ Inserts newlines if text is longer than `max_line_width`.
+ Defaults to ``numpy.get_printoptions()['linewidth']``.
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.
+ Defaults to ``numpy.get_printoptions()['precision']``.
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.
+ 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.
+ Defaults to ``numpy.get_printoptions()['suppress']``.
separator : str, optional
- Inserted between elements (default ' ').
+ Inserted between elements.
prefix : str, optional
suffix: str, optional
The length of the prefix and suffix strings are used to respectively
@@ -587,20 +588,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.
+ Defaults to ``numpy.get_printoptions()['threshold']``.
edgeitems : int, optional
Number of array items in summary at beginning and end of
each dimension.
- See `set_printoptions` for defaults.
+ Defaults to ``numpy.get_printoptions()['edgeitems']``.
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.
+ Defaults to ``numpy.get_printoptions()['sign']``.
floatmode : str, optional
Controls the interpretation of the `precision` option for
- floating-point types. See `set_printoptions` for defaults.
+ floating-point types.
+ Defaults to ``numpy.get_printoptions()['floatmode']``.
Can take the following values:
- 'fixed': Always print exactly `precision` fractional digits,
@@ -1465,17 +1467,17 @@ def array_repr(arr, max_line_width=None, precision=None, suppress_small=None):
arr : ndarray
Input array.
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.
+ Inserts newlines if text is longer than `max_line_width`.
+ Defaults to ``numpy.get_printoptions()['linewidth']``.
precision : int, optional
- Floating point precision. Default is the current printing precision
- (usually 8), which can be altered using `set_printoptions`.
+ Floating point precision.
+ Defaults to ``numpy.get_printoptions()['precision']``.
suppress_small : bool, optional
- 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.
+ 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.
+ Defaults to ``numpy.get_printoptions()['suppress']``.
Returns
-------
@@ -1547,15 +1549,16 @@ def array_str(a, max_line_width=None, precision=None, suppress_small=None):
Input array.
max_line_width : int, optional
Inserts newlines if text is longer than `max_line_width`.
- See `linewidth` in `set_printoptions` for defaults.
+ Defaults to ``numpy.get_printoptions()['linewidth']``.
precision : int, optional
- Floating point precision. Default is the current printing precision
- (usually 8), which can be altered using `set_printoptions`.
+ Floating point precision.
+ Defaults to ``numpy.get_printoptions()['precision']``.
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. See `suppress` in `set_printoptions` for defaults.
+ zero.
+ Defaults to ``numpy.get_printoptions()['suppress']``.
See Also
--------