bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / printoptions
function
numpy:printoptions
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/_core/arrayprint.py:391
Signature
def printoptions(*args, **kwargs)Summary
Context manager for setting print options.
Extended Summary
Set print options for the scope of the with block, and restore the old options at the end. See set_printoptions for the full description of available options.
Notes
These print options apply only to NumPy ndarrays, not to scalars.
Examples
import numpy as np
✓from numpy.testing import assert_equal with np.printoptions(precision=2): np.array([2.0]) / 3✓
array([0.67])The `as`-clause of the `with`-statement gives the current print options:
with np.printoptions(precision=2) as opts: assert_equal(opts, np.get_printoptions())✓
See also
Aliases
numpy.printoptions