numpy.mintypecode() function – Python (original) (raw)
Last Updated : 18 Jun, 2020
numpy.mintypecode()
function return the character for the minimum-size type to which given types can be safely cast.
Syntax : numpy.mintypecode(typechars, typeset = ‘GDFgdf’, default = ‘d’)
Parameters :
typechars : [list of str or array_like] If a list of strings, each string should represent a dtype. If array_like, the character representation of the array dtype is used.
typeset : [str or list of str, optional] The set of characters that the returned character is chosen from. The default set is ‘GDFgdf’.
default : [str, optional] The default character, this is returned if none of the characters in typechars matches a character in typeset.
Return : [str] The character representing the minimum-size type that was found.
Code #1 :
import
numpy as geek
gfg
=
geek.mintypecode([
'd'
,
'f'
,
'S'
])
print
(gfg)
Output :
d
Code #2 :
import
numpy as geek
x
=
geek.array([
1.1
,
2
-
1.j
])
gfg
=
geek.mintypecode(x)
print
(gfg)
Output :
D
Similar Reads
- Python | numpy.issctype() function numpy.issctype() function is used to determine whether the given object represents a scalar data-type.If the given object represents a scalar data-type it returns true, otherwise it returns false. Syntax : numpy.issctype(rep) Parameters : rep : any input. Return : [bool] Boolean result of check whet 1 min read
- Python | numpy.issubdtype() function numpy.issubdtype() function is used to determine whether the first argument is a typecode lower/equal in type hierarchy from second argument.If the first argument is lower or equal it returns true, otherwise it returns false. Syntax : numpy.issubdtype(arg1, arg2) Parameters : arg1, arg2 : [dtype_lik 1 min read
- numpy.iinfo() function – Python numpy.iinfo() function shows machine limits for integer types. Syntax : numpy.iinfo(dtype) Parameters : dtype : [integer type, dtype, or instance] The kind of integer data type to get information about. Return : Machine limits for integer types. Code #1 : # Python program explaining # numpy.iinfo() 1 min read
- Python | numpy.issubsctype() function numpy.issubsctype() function is used to determine whether the first argumentis a subclass of the second argument.If the first argument is a subclass of the second argument it returns true, otherwise it returns false. Syntax : numpy.issubsctype(arg1, arg2) Parameters : arg1, arg2 : dtype or dtype spe 1 min read
- numpy.dtype.kind() function – Python numpy.dtype.kind() function determine the character code by identifying the general kind of data. Syntax : numpy.dtype.kind(type) Parameters : type : [dtype] The input data-type. Return : Return the character code by identifying the general kind of data. Code #1 : # Python program explaining # numpy 1 min read
- OpenCV - imdecode() Function in Python cv2.imdecode() function is used to read image data from a memory cache and convert it into image format. This is generally used for loading the image efficiently from the internet. Example: Decoding and Saving an Image from URL in ColorThis example demonstrates how to download an image from a URL, 2 min read
- numpy.index() in Python numpy.core.defchararray.index(arr, substring, start=0, end=None): Finds the lowest index of the sub-string in the specified range But if substring is not found, it raises ValueError. Parameters: arr : array-like or string to be searched. substring : substring to search for. start, end : [int, option 1 min read
- numpy.issubclass_() function – Python numpy.issubclass_() function is used to determine whether a class is a subclass of a second class. Syntax : numpy.issubclass_(arg1, arg2) Parameters : arg1 : [class] Input class. True is returned if arg1 is a subclass of arg2. arg2 : [class or tuple of classes] Input class. If a tuple of classes, Tr 1 min read
- ord() function in Python Python ord() function returns the Unicode code of a given single character. It is a modern encoding standard that aims to represent every character in every language. Unicode includes: ASCII characters (first 128 code points)Emojis, currency symbols, accented characters, etc.For example, unicode of 2 min read
- numpy.char.add() function in Python The add() method of the char class in the NumPy module is used for element-wise string concatenation for two arrays of str or unicode. numpy.char.add()Syntax : numpy.char.add(x1, x2)Parameters : x1 : first array to be concatenated (concatenated at the beginning)x2 : second array to be concatenated ( 2 min read