MCPcopy Create free account
hub / github.com/numpy/numpy / array_str

Function array_str

numpy/core/arrayprint.py:1621–1657  ·  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

1619
1620@array_function_dispatch(_array_str_dispatcher, module='numpy')
1621def array_str(a, max_line_width=None, precision=None, suppress_small=None):
1622 """
1623 Return a string representation of the data in an array.
1624
1625 The data in the array is returned as a single string. This function is
1626 similar to `array_repr`, the difference being that `array_repr` also
1627 returns information on the kind of array and its data type.
1628
1629 Parameters
1630 ----------
1631 a : ndarray
1632 Input array.
1633 max_line_width : int, optional
1634 Inserts newlines if text is longer than `max_line_width`.
1635 Defaults to ``numpy.get_printoptions()['linewidth']``.
1636 precision : int, optional
1637 Floating point precision.
1638 Defaults to ``numpy.get_printoptions()['precision']``.
1639 suppress_small : bool, optional
1640 Represent numbers "very close" to zero as zero; default is False.
1641 Very close is defined by precision: if the precision is 8, e.g.,
1642 numbers smaller (in absolute value) than 5e-9 are represented as
1643 zero.
1644 Defaults to ``numpy.get_printoptions()['suppress']``.
1645
1646 See Also
1647 --------
1648 array2string, array_repr, set_printoptions
1649
1650 Examples
1651 --------
1652 >>> np.array_str(np.arange(3))
1653 '[0 1 2]'
1654
1655 """
1656 return _array_str_implementation(
1657 a, max_line_width, precision, suppress_small)
1658
1659
1660# needed if __array_function__ is disabled

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected