numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
isreal(x)

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

Notes

isreal may behave unexpectedly for string or object arrays (see examples)

Parameters

x : array_like

Input array.

Returns

out : ndarray, bool

Boolean array of same shape as x.

Returns a bool array, where True if input element is real.

See Also

iscomplex
isrealobj

Return True if x is not a complex type.

Examples

>>> a = np.array([1+1j, 1+0j, 4.5, 3, 2, 2j], dtype=complex)
... np.isreal(a) array([False, True, True, True, True, False])

The function does not work on string arrays.

>>> a = np.array([2j, "a"], dtype="U")
... np.isreal(a) # Warns about non-elementwise comparison False

Returns True for all elements in input array of dtype=object even if any of the elements is complex.

>>> a = np.array([1, "2", 3+4j], dtype=object)
... np.isreal(a) array([ True, True, True])

isreal should not be used with object arrays

>>> a = np.array([1+2j, 2+1j], dtype=object)
... np.isreal(a) array([ True, True])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.isreal numpy.isrealobj numpy.iscomplex

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/type_check.py#247
type: <class 'function'>
Commit: