Return the string representation of an array. Parameters ---------- arr : ndarray Input array. max_line_width : int, optional Inserts newlines if text is longer than `max_line_width`. Defaults to ``numpy.get_printoptions()['linewidth']``. precision :
(arr, max_line_width=None, precision=None, suppress_small=None)
| 1538 | |
| 1539 | @array_function_dispatch(_array_repr_dispatcher, module='numpy') |
| 1540 | def array_repr(arr, max_line_width=None, precision=None, suppress_small=None): |
| 1541 | """ |
| 1542 | Return the string representation of an array. |
| 1543 | |
| 1544 | Parameters |
| 1545 | ---------- |
| 1546 | arr : ndarray |
| 1547 | Input array. |
| 1548 | max_line_width : int, optional |
| 1549 | Inserts newlines if text is longer than `max_line_width`. |
| 1550 | Defaults to ``numpy.get_printoptions()['linewidth']``. |
| 1551 | precision : int, optional |
| 1552 | Floating point precision. |
| 1553 | Defaults to ``numpy.get_printoptions()['precision']``. |
| 1554 | suppress_small : bool, optional |
| 1555 | Represent numbers "very close" to zero as zero; default is False. |
| 1556 | Very close is defined by precision: if the precision is 8, e.g., |
| 1557 | numbers smaller (in absolute value) than 5e-9 are represented as |
| 1558 | zero. |
| 1559 | Defaults to ``numpy.get_printoptions()['suppress']``. |
| 1560 | |
| 1561 | Returns |
| 1562 | ------- |
| 1563 | string : str |
| 1564 | The string representation of an array. |
| 1565 | |
| 1566 | See Also |
| 1567 | -------- |
| 1568 | array_str, array2string, set_printoptions |
| 1569 | |
| 1570 | Examples |
| 1571 | -------- |
| 1572 | >>> np.array_repr(np.array([1,2])) |
| 1573 | 'array([1, 2])' |
| 1574 | >>> np.array_repr(np.ma.array([0.])) |
| 1575 | 'MaskedArray([0.])' |
| 1576 | >>> np.array_repr(np.array([], np.int32)) |
| 1577 | 'array([], dtype=int32)' |
| 1578 | |
| 1579 | >>> x = np.array([1e-6, 4e-7, 2, 3]) |
| 1580 | >>> np.array_repr(x, precision=6, suppress_small=True) |
| 1581 | 'array([0.000001, 0. , 2. , 3. ])' |
| 1582 | |
| 1583 | """ |
| 1584 | return _array_repr_implementation( |
| 1585 | arr, max_line_width, precision, suppress_small) |
| 1586 | |
| 1587 | |
| 1588 | @_recursive_guard() |
nothing calls this directly
no test coverage detected