Python | numpy.issubsctype () function

NumPy | Python Methods and Functions

numpy.issubsctype() is used to determine if the first argument is 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 specifier.

Return: [bool ] Boolean result.

Code # 1:

# Python program explaining
# numpy.issubsctype () function

 
# numpy import

import numpy as geek

 
# argument selection

 

arg1 = geek.array ([ 1.0 , 2.5 , 3.9 ])

arg2 = geek. int

  
# output boolean

out_val = geek.issubsctype (arg1, arg2)

print ( "Is the first argument subclass of the second argument:" , out_val) 

Output:

 Is the first argument subclass of the second argument: False 

Code # 2: < / p>

# Python program explaining
# numpy.issubsctype () function

 
# numpy import

import numpy as geek

  
# argument selection

 

arg1 = geek.array ([ 1.0 , 2.5 , 3.9 ])

arg2 = geek. float

< code class = "undefined spaces">  
# output boolean

out_val = geek.issubsctype (arg1, arg2)

print ( "Is the first argument subclass of the second argument:" , out_val) 

Output:

 Is the first argument subclass of the second argument: True 




Get Solution for free from DataCamp guru