numpy.__array_namespace_info__.dtypes#
method
- __array_namespace_info__.dtypes(*, device=None, kind=None)[source]#
The array API data types supported by NumPy.
Note that this function only returns data types that are defined by the array API.
- Parameters:
- devicestr, optional
The device to get the data types for. For NumPy, only
'cpu'is allowed.- kindstr or tuple of str, optional
The kind of data types to return. If
None, all data types are returned. If a string, only data types of that kind are returned. If a tuple, a dictionary containing the union of the given kinds is returned. The following kinds are supported:'bool': boolean data types (i.e.,bool).'signed integer': signed integer data types (i.e.,int8,int16,int32,int64).'unsigned integer': unsigned integer data types (i.e.,uint8,uint16,uint32,uint64).'integral': integer data types. Shorthand for('signed integer', 'unsigned integer').'real floating': real-valued floating-point data types (i.e.,float32,float64).'complex floating': complex floating-point data types (i.e.,complex64,complex128).'numeric': numeric data types. Shorthand for('integral', 'real floating', 'complex floating').
- Returns:
- dtypesdict
A dictionary mapping the names of data types to the corresponding NumPy data types.
See also
Examples
>>> info = np.__array_namespace_info__() >>> info.dtypes(kind='signed integer') {'int8': numpy.int8, 'int16': numpy.int16, 'int32': numpy.int32, 'int64': numpy.int64}