HTTP/1.1 301 Moved Permanently
Date: Mon, 28 Jul 2025 06:16:57 GMT
Server: Apache/2.4.39 (Ubuntu)
Location: https://numpy.org/doc/stable/reference/generated/numpy.printoptions.html
Content-Length: 361
Content-Type: text/html; charset=iso-8859-1
HTTP/2 200
date: Mon, 28 Jul 2025 06:16:57 GMT
content-type: text/html; charset=utf-8
server: cloudflare
x-origin-cache: HIT
last-modified: Fri, 25 Jul 2025 11:41:59 GMT
access-control-allow-origin: *
expires: Mon, 28 Jul 2025 06:26:57 GMT
cache-control: max-age=600
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=omM4Gjpy3CcmbZKVeJ%2BiuXUhw6N4wHf8mX7QKRkzWXb7e0a6NWOAJILTgR7ZtLh0hgYBr7HoR7pIQQTYAZwQxBj93bZQGOzKkA%3D%3D"}]}
x-proxy-cache: MISS
x-github-request-id: AE0F:91AA9:1BD80B:21422F:688715D5
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210040-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753683417.366628,VS0,VE210
vary: Accept-Encoding
x-fastly-request-id: 39385389d2345e5f0cba04703b62d57f37ccd4c2
cf-cache-status: DYNAMIC
content-encoding: gzip
cf-ray: 9662402e492e4936-BOM
alt-svc: h3=":443"; ma=86400
numpy.printoptions — NumPy v2.3 Manual
Back to top
numpy.printoptions
numpy. printoptions ( * args , ** kwargs ) [source]
Context manager for setting print options.
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.
Examples
Try it in your browser!
>>> 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 ())