numpy.array_repr

numpy.array_repr(arr, max_line_width=None, precision=None, suppress_small=None)

Return the string representation of an array.

Parameters:

arr : ndarray

Input array.

max_line_width : int

The maximum number of columns the string should span. Newline characters splits the string appropriately after array elements.

precision : int

Floating point precision.

suppress_small : bool

Represent very small numbers as zero.

Returns:

string : str

The string representation of an array.

Examples

>>> np.array_repr(np.array([1,2]))
'array([1, 2])'
>>> np.array_repr(np.ma.array([0.]))
'MaskedArray([ 0.])'
>>> np.array_repr(np.array([], np.int32))
'array([], dtype=int32)'

Previous topic

numpy.ndarray.tolist

Next topic

numpy.array_str

This Page

Quick search