numpy.isreal(array) : Test element-wise whether it is a real number or not(not infinity or not 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
import numpy as geek
print ( "Is Real : " , geek.isreal([ 1 + 1j , 0j ]), "\n" )
print ( "Is Real : " , geek.isreal([ 1 , 0 ]), "\n" )
|
Output :
Is Real : [False True]
Is Real : [ True True]
Code 2 :
Python
import numpy as geek
a = geek.arange( 20 ).reshape( 5 , 4 )
print ( "Is Real : \n" , geek.isreal(a), "\n" )
a = geek.arange( 20 ).reshape( 5 , 4 ).dtype = float
print ( "\nIs Real : " , geek.isreal(a))
|
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
Note :
These codes won’t run on online IDE’s. So please, run them on your systems to explore the working.
Last Updated :
08 Mar, 2024
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...