NumPy Input and Output: printoptions() function
numpy.printoptions() function
The printoption() function is a context manager for setting print options.
Set print options for the scope of the with block, and restore the old options at the end.
Syntax:
numpy.printoptions(*args, **kwargs)
Version: 1.15.0
NumPy.printoptions() method Example:
>>> import numpy as np
>>> with np.printoptions(precision=3):
... print(np.array([3.0/4]))
Output:
[0.75]
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())
Python - NumPy Code Editor:
Previous: set_string_function()
Next: binary_repr() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/numpy/input-and-output/printoptions.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics