numpy.isreal () in Python



numpy.isreal (array): Test element by element if it is a real number or not (not infinity or not a Number) and return the result as a boolean array. 
Parameters:

  array:  [array_like] Input array whose element we want to test 

Return:

 boolean array containing the result 

Code 1:

# Python program illustrating
# numpy.isreal () method

  

import numpy as geek 

 

print ( "Is Real:" , geek.isreal ([ 1 + 1j , 0j ]), " " )

  

print ( "Is Real:" , geek.isreal ([ 1 , 0 ]), "" )

Output:

 Is Real: [False True] Is Real: [True True] 

Code 2:

Output:

 Is Real: [[True True True True] [True True True True] [True True True True] [True True True True] [True True True True]] Is Real: True 

Links:
https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.isreal.html # numpy.isreal

Notes:
These codes will not work for online IDs. Please run them on your systems to see how they work

This article is provided by Mohit Gupta_OMG


# Python program illustrating
# numpy.isreal () method

 

import numpy as geek 

 
# Returns True / False for each element

a = geek.arange ( 20 ). reshape ( 5 , 4 )

print ( "Is Real:" , geek.isreal (a), "" )

 
# Returns True / False value as ANS
# because we mentioned dtpe at the beginning

a = geek.arange ( 20 ). reshape ( 5 , 4 ). dtype = float

print ( " Is Real: " , geek.isreal (a))