numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
min_scalar_type(a, /)

Floating point values are not demoted to integers, and complex values are not demoted to floats.

Notes

versionadded

Parameters

a : scalar or array_like

The value whose minimal data type is to be found.

Returns

out : dtype

The minimal data type.

For scalar a , returns the data type with the smallest size and smallest scalar kind which can hold its value. For non-scalar array a , returns the vector's dtype unmodified.

See Also

can_cast
dtype
promote_types
result_type

Examples

>>> np.min_scalar_type(10)
dtype('uint8')
>>> np.min_scalar_type(-260)
dtype('int16')
>>> np.min_scalar_type(3.1)
dtype('float16')
>>> np.min_scalar_type(1e50)
dtype('float64')
>>> np.min_scalar_type(np.arange(4,dtype='f8'))
dtype('float64')
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.result_type numpy.core._multiarray_umath.result_type

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : None#None
type: <class 'function'>
Commit: