๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ arrays.dtypes.html
Data type objects (dtype) โ€” NumPy v2.5 Manual
Whenever a data-type is required in a NumPy function or method, either a dtype object or something that can be converted to one can be supplied. Such conversions are done by the dtype constructor: What can be converted to a data-type object is described below: ... Used as-is. ... The default data type: float64. ... The 24 built-in array scalar type objects all convert to an associated data-type object.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ numpy โ€บ numpy_data_types.asp
NumPy Data Types
We use the array() function to create arrays, this function can take an optional argument: dtype that allows us to define the expected data type of the array elements: ... import numpy as np arr = np.array([1, 2, 3, 4], dtype='S') print(arr) ...
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ user โ€บ basics.types.html
Data types โ€” NumPy v2.5 Manual
Some dtypes have trailing underscore ... aliases are provided (See Sized aliases). NumPy generally returns elements of arrays as array scalars (a scalar with an associated dtype)....
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.3 โ€บ reference โ€บ arrays.dtypes.html
Data type objects (dtype) โ€” NumPy v2.3 Manual
Whenever a data-type is required in a NumPy function or method, either a dtype object or something that can be converted to one can be supplied. Such conversions are done by the dtype constructor: What can be converted to a data-type object is described below: ... Used as-is. ... The default data type: float64. ... The 24 built-in array scalar type objects all convert to an associated data-type object.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ generated โ€บ numpy.dtype.html
numpy.dtype โ€” NumPy v2.1 Manual
The array-protocol typestring of this data-type object. ... Tuple (item_dtype, shape) if this dtype describes a sub-array, and None otherwise.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ arrays.dtypes.html
Data type objects (dtype) โ€” NumPy v2.1 Manual
NumPy allows a modification on the format in that any string that can uniquely identify the type can be used to specify the data-type in a field. The generated data-type fields are named 'f0', 'f1', โ€ฆ, 'f<N-1>' where N (>1) is the number of comma-separated basic formats in the string.
๐ŸŒ
Python Course
python-course.eu โ€บ numerical-programming โ€บ numpy-data-objects-dtype.php
3. Numpy Data Objects, dtype | Numerical Programming
Before we work with a complex data structure like the one shown above, letโ€™s first introduce dtype using a very simple example. We define a data type based on int16 and refer to it as i16. (Admittedly, this isnโ€™t a very descriptive name, but weโ€™ll use it just for this example.) The elements of a list named lst are then converted to the i16 type to create a two-dimensional array called A. import numpy as np i16 = np.dtype(np.int16) print(i16) lst = [ [3.4, 8.7, 9.9], [1.1, -7.8, -0.7], [4.1, 12.3, 4.8] ] A = np.array(lst, dtype=i16) print(A)
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.2 โ€บ reference โ€บ generated โ€บ numpy.ndarray.dtype.html
numpy.ndarray.dtype โ€” NumPy v2.2 Manual
Setting will replace the dtype without modifying the memory (see also ndarray.view and ndarray.astype). ... Cast the values contained in the array to a new data-type.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.dtype.html
numpy.dtype โ€” NumPy v2.5 Manual
The array-protocol typestring of this data-type object. ... Tuple (item_dtype, shape) if this dtype describes a sub-array, and None otherwise.
Find elsewhere
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ user โ€บ basics.types.html
Data types โ€” NumPy v2.6.dev0 Manual
Some dtypes have trailing underscore ... aliases are provided (See Sized aliases). NumPy generally returns elements of arrays as array scalars (a scalar with an associated dtype)....
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.2 โ€บ reference โ€บ arrays.dtypes.html
Data type objects (dtype) โ€” NumPy v2.2 Manual
Whenever a data-type is required in a NumPy function or method, either a dtype object or something that can be converted to one can be supplied. Such conversions are done by the dtype constructor: What can be converted to a data-type object is described below: ... Used as-is. ... The default data type: float64. ... The 24 built-in array scalar type objects all convert to an associated data-type object.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.ndarray.dtype.html
numpy.ndarray.dtype โ€” NumPy v2.5 Manual
January 31, 2021 - Setting will replace the dtype without modifying the memory (see also ndarray.view and ndarray.astype). ... Cast the values contained in the array to a new data-type. ... Create a view of the same data but a different data-type. ... 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
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ data-type-object-dtype-numpy-python
Data type Object (dtype) in NumPy Python - GeeksforGeeks
May 20, 2026 - Explanation: attribute arr.dtype returns the data type of the array elements, which is int in this case because all values are integers. A dtype object is an instance of the numpy.dtype class.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ generated โ€บ numpy.ndarray.dtype.html
numpy.ndarray.dtype โ€” NumPy v2.1 Manual
Setting will replace the dtype without modifying the memory (see also ndarray.view and ndarray.astype). ... Cast the values contained in the array to a new data-type.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ numpy โ€บ numpy_data_types.htm
NumPy - Data Types
In NumPy, you can explicitly specify the data type (dtype) of the elements in an array at the time of its creation.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ reference โ€บ generated โ€บ numpy.dtype.html
numpy.dtype โ€” NumPy v2.6.dev0 Manual
The array-protocol typestring of this data-type object. ... Tuple (item_dtype, shape) if this dtype describes a sub-array, and None otherwise.
๐ŸŒ
Medium
medium.com โ€บ data-science-collective โ€บ do-more-with-numpy-array-type-hints-annotate-validate-shape-dtype-09f81c496746
Do More with NumPy Array Type Hints: Annotate & Validate Shape & Dtype | by Christopher Ariza | Data Science Collective | Medium
May 26, 2025 - The NumPy array object can take many concrete forms. It might be a one-dimensional (1D) array of Booleans, or a three-dimensional (3D) array of 8-bit unsigned integers. As the built-in function isinstance() will show, every array is an instance of np.ndarray, regardless of shape or the type of elements stored in the array, i.e., the dtype.
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ numpy โ€บ data-types
NumPy Data Types
The `dtype` in NumPy is used to specify the desired data type for the elements of an array.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python โ€บ numpy
NumPy: astype() to change dtype of an array | note.nkmk.me
February 4, 2024 - NumPy arrays (ndarray) hold a data type (dtype). You can set this through various operations, such as when creating an ndarray with np.array(), or change it later with astype(). Data type objects (dty ...
Top answer
1 of 1
4

A python list can contain disparately typed objects, e.g. X = ['apples', 'oranges',10]. If you do type([10]) you'll see the Python type for the container is technically called a list, not an array.

In contrast, in a numpy array all objects are of the same type, the dtype.

The docs are telling you that on creation of a numpy array, the dtype is set to the type that will hold all of the existing objects.

See, look:

the type will be determined as the minimum type required to hold the objects in the sequence

The writers perhaps should have added "and not their values"

We can make a uint8 ten easily enough:

ten = np.uint8(10)

If that is put into a Python list, it retains its type because Python lists preserve types. If that list is sent to numpy.array() to make a numpy array, then the numpy array will use dtype np.uint8 because it is big enough to hold all (1) of the pre-existing Python list objects.

In [49]: np.array([ten]).dtype
Out[49]: dtype('uint8')

But if we use a literal 10, python will create an int object for it instead of an np.uint8 because np.uint8 is peculiar to numpy and all 10 does is invoke python to create that number.

If we make a Python list containing a literal 10, we duplicate your result (with machine-architecture ints):

In [50]: np.array([10]).dtype
Out[50]: dtype('int64')

And if we put the two types together in a python list, and send that list to np.array for creation of a numpy array, then the dtype must be big enough to hold both objects, in this case int64.

In [51]: np.array([ten, 10]).dtype
Out[51]: dtype('int64')