To determine whether the given object represents a scalar data-type, use the numpy.issctype() method. The method returns Boolean result of check whether rep is a scalar dtype. The first parameter is the rep. If rep is an instance of a scalar dtype, True is returned.If not, False is returned.
Steps
At first, import the required library −
import numpy as np
Using the issctype() method in Numpy −
print("Result...",np.issctype(np.int32)) print("Result...",np.issctype(np.int64)) print("Result...",np.issctype(np.dtype('str'))) print("Result...",np.issctype(100)) print("Result...",np.issctype(25.9)) print("Result...",np.issctype(np.float32(22.3)))
Example
import numpy as np # To determine whether the given object represents a scalar datatype, use the numpy.issctype() method # The method returns Boolean result of check whether rep is a scalar dtype. # The first parameter is the rep. If rep is an instance of a scalar dtype, True is returned.If not, False is returned. print("Using the issctype() method in Numpy\n") print("Result...",np.issctype(np.int32)) print("Result...",np.issctype(np.int64)) print("Result...",np.issctype(np.dtype('str'))) print("Result...",np.issctype(100)) print("Result...",np.issctype(25.9)) print("Result...",np.issctype(np.float32(22.3)))
Output
Using the issctype() method in Numpy Result... True Result... True Result... True Result... False Result... False Result... False