w3resource

NumPy Logic functions: isreal() function

numpy.isreal() function

The isreal() function is used to test a bool array, where True if input element is real.

If element has complex type with zero complex part, the return value for that element is True.

Syntax:

numpy.isreal(x)

Version: 1.15.0

Parameter:

Name Description Required /
Optional
x Input array.
array_like
Required

Returns:
out : ndarray, bool - Boolean array of same shape as x.

NumPy.isreal() method Example:

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

Output:

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

Python - NumPy Code Editor:

Previous: isfortran() function
Next: isrealobj() function



Follow us on Facebook and Twitter for latest update.