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–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.printoptions.html