numpy.array_str
-
numpy.array_str(a, max_line_width=None, precision=None, suppress_small=None)
[source] -
Return a string representation of the data in an array.
The data in the array is returned as a single string. This function is similar to
array_repr
, the difference being thatarray_repr
also returns information on the kind of array and its data type.- Parameters
-
-
andarray
-
Input array.
-
max_line_widthint, optional
-
Inserts newlines if text is longer than
max_line_width
. Defaults tonumpy.get_printoptions()['linewidth']
. -
precisionint, optional
-
Floating point precision. Defaults to
numpy.get_printoptions()['precision']
. -
suppress_smallbool, 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
Examples
>>> np.array_str(np.arange(3)) '[0 1 2]'
© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.19/reference/generated/numpy.array_str.html