w3resource

NumPy Logic functions: iscomplex() function

numpy.iscomplex() function

The iscomplex() function is used to returns a bool array, where True if input element is complex.

What is tested is whether the input has a non-zero imaginary part, not if the input type is complex.

Syntax:

numpy.iscomplex(x)

Version: 1.15.0

Parameter:

Name Description Required /
Optional
x Input array.
array_like
Required

Returns:
out : ndarray of bools - Output array.

NumPy.iscomplex() method Example:

>>> import numpy as np
>>> np.iscomplex([2+2j, 1+0j, 5.5, 4, 2, 2j])

Output:

array([ True, False, False, False, False,  True])

Python - NumPy Code Editor:

Previous: isposinf() function
Next: iscomplexobj() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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/iscomplex.php