NumPy Logic functions: iscomplexobj() function
numpy.iscomplexobj() function
The iscomplexobj() function is used to check for a complex type or an array of complex numbers.
The type of the input is checked, not the value. Even if the input has an imaginary part equal to zero, iscomplexobj evaluates to True.
Syntax:
numpy.iscomplexobj(x)
Version: 1.15.0
Parameter:
Name | Description | Required / Optional |
---|---|---|
x | The input can be of any type and shape. any |
Required |
Returns:
iscomplexobj : bool - The return value, True if x is of a complex type or has at least one complex element.
NumPy.iscomplexobj() method Example-1:
>>> import numpy as np
>>> np.iscomplexobj(3)
Output:
False
NumPy.iscomplexobj() method Example-2:
>>> import numpy as np
>>> np.iscomplexobj(3+0j)
Output:
True
NumPy.iscomplexobj() method Example-3:
>>> import numpy as np
>>> np.iscomplexobj([5, 3+0j, True])
Output:
True
Python - NumPy Code Editor:
Previous: iscomplex() function
Next: isfortran() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/numpy/logic-functions/iscomplexobj.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics