[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../generated/../generated/numpy.ndarray.dtype.html [Back]  [Original]

numpy.ndarray.dtype — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.ndarray.dtype#

attribute

ndarray.dtype#

Data-type of the arrays elements.

Warning

Setting arr.dtype is discouraged and may be deprecated in the future. Setting will replace the dtype without modifying the memory (see also ndarray.view and ndarray.astype).

Parameters:
None
Returns:
dnumpy dtype object

See also

ndarray.astype

Cast the values contained in the array to a new data-type.

ndarray.view

Create a view of the same data but a different data-type.

numpy.dtype

Examples

Try it in your browser!
>>> import numpy as np
>>> x = np.arange(4).reshape((2, 2))
>>> x
array([[0, 1],
       [2, 3]])
>>> x.dtype
dtype('int64')   # may vary (OS, bitness)
>>> isinstance(x.dtype, np.dtype)
True

Web Proxy Viewer  |  New URL  |  Original Page