numpy.array_str

numpy.array_str(a, max_line_width=None, precision=None, suppress_small=None)

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 is that array_repr also returns information on the type of array and data type.

Parameters:

a : ndarray

Input array.

max_line_width : int, optional

Inserts newlines if text is longer than max_line_width.

precision : int, optional

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, 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 also

array2string, array_repr, set_printoptions

Examples

>>> np.array_str(np.arange(3))
>>> '[0 1 2]'

Previous topic

numpy.array_repr

Next topic

numpy.memmap

This Page