MCPcopy Index your code
hub / github.com/numpy/numpy / array_str

Function array_str

numpy/_core/arrayprint.py:1743–1780  ·  view source on GitHub ↗

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

(a, max_line_width=None, precision=None, suppress_small=None)

Source from the content-addressed store, hash-verified

1741
1742@array_function_dispatch(_array_str_dispatcher, module='numpy')
1743def array_str(a, max_line_width=None, precision=None, suppress_small=None):
1744 """
1745 Return a string representation of the data in an array.
1746
1747 The data in the array is returned as a single string. This function is
1748 similar to `array_repr`, the difference being that `array_repr` also
1749 returns information on the kind of array and its data type.
1750
1751 Parameters
1752 ----------
1753 a : ndarray
1754 Input array.
1755 max_line_width : int, optional
1756 Inserts newlines if text is longer than `max_line_width`.
1757 Defaults to ``numpy.get_printoptions()['linewidth']``.
1758 precision : int, optional
1759 Floating point precision.
1760 Defaults to ``numpy.get_printoptions()['precision']``.
1761 suppress_small : bool, optional
1762 Represent numbers "very close" to zero as zero; default is False.
1763 Very close is defined by precision: if the precision is 8, e.g.,
1764 numbers smaller (in absolute value) than 5e-9 are represented as
1765 zero.
1766 Defaults to ``numpy.get_printoptions()['suppress']``.
1767
1768 See Also
1769 --------
1770 array2string, array_repr, set_printoptions
1771
1772 Examples
1773 --------
1774 >>> import numpy as np
1775 >>> np.array_str(np.arange(3))
1776 '[0 1 2]'
1777
1778 """
1779 return _array_str_implementation(
1780 a, max_line_width, precision, suppress_small)
1781
1782
1783# needed if __array_function__ is disabled

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…