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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework