promote_types(type1, type2)
This function is symmetric, but rarely associative.
Starting in NumPy 1.9, promote_types function now returns a valid string length when given an integer or float dtype as one argument and a string dtype as another argument. Previously it always returned the input string dtype, even if it wasn't long enough to store the max integer/float value converted to a string.
First data type.
Second data type.
The promoted data type.
Returns the data type with the smallest size and smallest scalar kind to which both type1
and type2
may be safely cast. The returned data type is always in native byte order.
>>> np.promote_types('f4', 'f8') dtype('float64')
>>> np.promote_types('i8', 'f4') dtype('float64')
>>> np.promote_types('>i8', '<c8') dtype('complex128')
>>> np.promote_types('i4', 'S8') dtype('S11')
An example of a non-associative case:
>>> p = np.promote_types
... p('S', p('i1', 'u1')) dtype('S6')
>>> p(p('S', 'i1'), 'u1') dtype('S4')See :
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.result_type
numpy.min_scalar_type
numpy.core._multiarray_umath.min_scalar_type
numpy.core._multiarray_umath.result_type
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