numpy.
mintypecode
Return the character for the minimum-size type to which given types can be safely cast.
The returned type character must represent the smallest size dtype such that an array of the returned type can handle the data from an array of all types in typechars (or if typechars is an array, then its dtype.char).
If a list of strings, each string should represent a dtype. If array_like, the character representation of the array dtype is used.
The set of characters that the returned character is chosen from. The default set is ‘GDFgdf’.
The default character, this is returned if none of the characters in typechars matches a character in typeset.
The character representing the minimum-size type that was found.
See also
dtype
sctype2char
maximum_sctype
Examples
>>> np.mintypecode(['d', 'f', 'S']) 'd' >>> x = np.array([1.1, 2-3.j]) >>> np.mintypecode(x) 'D'
>>> np.mintypecode('abceh', default='G') 'G'