bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / array_repr
_ArrayFunctionDispatcher
numpy:array_repr
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/_core/arrayprint.py :1644
Signature
def array_repr ( arr , max_line_width = None , precision = None , suppress_small = None ) Summary
Return the string representation of an array.
Parameters
arr: ndarrayInput array.
max_line_width: int, optionalInserts newlines if text is longer than
max_line_width. Defaults tonumpy.get_printoptions()['linewidth'].precision: int, optionalFloating point precision. Defaults to
numpy.get_printoptions()['precision'].suppress_small: bool, optionalRepresent 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
string: strThe string representation of an array.
Examples
import numpy as np np.array_repr(np.array([1,2])) np.array_repr(np.ma.array([0.])) np.array_repr(np.array([], np.int32))✓
x = np.array([1e-6, 4e-7, 2, 3])
✓np.array_repr(x, precision=6, suppress_small=True)
✗See also
- array2string
- array_str
- set_printoptions
Aliases
-
numpy.array_repr