Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Module « numpy »

Fonction isreal - module numpy

Signature de la fonction isreal

def isreal(x) 

Description

help(numpy.isreal)

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

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

Parameters
----------
x : array_like
    Input array.

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

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

See Also
--------
iscomplex
isrealobj : Return True if x is not a complex type.

Examples
--------
>>> import numpy as np
>>> 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])



Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé