diff options
author | Matti Picus <matti.picus@gmail.com> | 2019-05-29 08:24:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 08:24:04 +0300 |
commit | 4d51ffb70559653acb6c6c62959413bb9df31662 (patch) | |
tree | 5431de59bb385b7236cf886c9cbe684e739a7b56 /numpy | |
parent | f90270b1f3e3ac5de7ef36dd152c9a96d4ca05e4 (diff) | |
parent | c9641f84a5fd77841e0d70c062a9457bd9e12e75 (diff) | |
download | numpy-4d51ffb70559653acb6c6c62959413bb9df31662.tar.gz |
Merge pull request #13406 from mikelui/master
DOC: clarify array_{2string,str,repr} defaults
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/arrayprint.py | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 7d8785c32..3e8cdf6ab 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 @@ -530,14 +531,17 @@ 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. + 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. + 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. prefix : str, optional @@ -584,17 +588,22 @@ def array2string(a, max_line_width=None, precision=None, threshold : int, optional Total number of array elements which trigger summarization rather than full repr. + Defaults to ``numpy.get_printoptions()['threshold']``. edgeitems : int, optional Number of array items in summary at beginning and end of each dimension. + 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. + Defaults to ``numpy.get_printoptions()['sign']``. floatmode : str, optional Controls the interpretation of the `precision` option for - floating-point types. Can take the following values: + floating-point types. + Defaults to ``numpy.get_printoptions()['floatmode']``. + Can take the following values: - 'fixed': Always print exactly `precision` fractional digits, even if this would print more or fewer digits than @@ -1458,15 +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. + 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. + 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 ------- @@ -1537,16 +1548,17 @@ 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`. + 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. + Defaults to ``numpy.get_printoptions()['suppress']``. See Also -------- |