MCPcopy Create free account
hub / github.com/numpy/numpy / set_printoptions

Function set_printoptions

numpy/core/arrayprint.py:117–292  ·  view source on GitHub ↗

Set printing options. These options determine the way floating point numbers, arrays and other NumPy objects are displayed. Parameters ---------- precision : int or None, optional Number of digits of precision for floating point output (default 8). May be N

(precision=None, threshold=None, edgeitems=None,
                     linewidth=None, suppress=None, nanstr=None, infstr=None,
                     formatter=None, sign=None, floatmode=None, *, legacy=None)

Source from the content-addressed store, hash-verified

115
116@set_module('numpy')
117def set_printoptions(precision=None, threshold=None, edgeitems=None,
118 linewidth=None, suppress=None, nanstr=None, infstr=None,
119 formatter=None, sign=None, floatmode=None, *, legacy=None):
120 """
121 Set printing options.
122
123 These options determine the way floating point numbers, arrays and
124 other NumPy objects are displayed.
125
126 Parameters
127 ----------
128 precision : int or None, optional
129 Number of digits of precision for floating point output (default 8).
130 May be None if `floatmode` is not `fixed`, to print as many digits as
131 necessary to uniquely specify the value.
132 threshold : int, optional
133 Total number of array elements which trigger summarization
134 rather than full repr (default 1000).
135 To always use the full repr without summarization, pass `sys.maxsize`.
136 edgeitems : int, optional
137 Number of array items in summary at beginning and end of
138 each dimension (default 3).
139 linewidth : int, optional
140 The number of characters per line for the purpose of inserting
141 line breaks (default 75).
142 suppress : bool, optional
143 If True, always print floating point numbers using fixed point
144 notation, in which case numbers equal to zero in the current precision
145 will print as zero. If False, then scientific notation is used when
146 absolute value of the smallest number is < 1e-4 or the ratio of the
147 maximum absolute value to the minimum is > 1e3. The default is False.
148 nanstr : str, optional
149 String representation of floating point not-a-number (default nan).
150 infstr : str, optional
151 String representation of floating point infinity (default inf).
152 sign : string, either '-', '+', or ' ', optional
153 Controls printing of the sign of floating-point types. If '+', always
154 print the sign of positive values. If ' ', always prints a space
155 (whitespace character) in the sign position of positive values. If
156 '-', omit the sign character of positive values. (default '-')
157 formatter : dict of callables, optional
158 If not None, the keys should indicate the type(s) that the respective
159 formatting function applies to. Callables should return a string.
160 Types that are not specified (by their corresponding keys) are handled
161 by the default formatters. Individual types for which a formatter
162 can be set are:
163
164 - 'bool'
165 - 'int'
166 - 'timedelta' : a `numpy.timedelta64`
167 - 'datetime' : a `numpy.datetime64`
168 - 'float'
169 - 'longfloat' : 128-bit floats
170 - 'complexfloat'
171 - 'longcomplexfloat' : composed of two 128-bit floats
172 - 'numpystr' : types `numpy.bytes_` and `numpy.str_`
173 - 'object' : `np.object_` arrays
174

Callers

nothing calls this directly

Calls 3

set_legacy_print_modeFunction · 0.90
_make_options_dictFunction · 0.85
updateMethod · 0.80

Tested by

no test coverage detected