numpy.printoptions
- numpy.printoptions(*args, **kwargs)[source]
-
Менеджер контекста для установки параметров вывода.
Установите параметры вывода для области действия
withблока и восстановите старые параметры в конце. См.set_printoptionsдля полного описания доступных параметров.См. также
Примеры
>>> from numpy.testing import assert_equal >>> with np.printoptions(precision=2): ... np.array([2.0]) / 3 array([0.67])
Часть
asоператораwithпоказывает текущие параметры вывода:>>> with np.printoptions(precision=2) as opts: ... assert_equal(opts, np.get_printoptions())
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.0/reference/generated/numpy.printoptions.html