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