numpy.isrealobj() in Python Last Updated : 07 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report numpy.isrealobj(array) : This logical function helps to checks if the array has no complex type or array has a complex number. Even if imaginary part is equal to zero, it is not considered to be a Real Object. Parameters : array : [array_like]Input array or object whose elements, we need to test. Return : True, if the input array hasn't any complex element; otherwise False Code 1 : Python # Python program explaining # isrealobj() function import numpy as np in_array = [1, 3, 5, 4] print ("Input array : ", in_array) output_value = np.isrealobj(in_array) print ("\nIs real : ", output_value) Output : Input array : [1, 3, 5, 4] Is real : True Code 2 : Python # Python Program illustrating # numpy.isrealobj() method import numpy as geek # Returns True/False value for each element a = geek.arange(20).reshape(5, 4) print("Is real : ", geek.isrealobj(a)) # Returns True/False value as ans # because we have mentioned dtpe in the beginning b = geek.arange(20).reshape(5, 4).dtype = complex print("\n",b) print("\nIs real : ", geek.isrealobj(b)) b = [[1j], [3]] print("\nIs real : ", geek.isrealobj(b)) Output : Is real : True class 'complex' Is real : True Is real : False References : https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.isrealobj.html#numpy.isrealobj . Comment More infoAdvertise with us Next Article numpy.isrealobj() in Python M mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-Logic Functions Practice Tags : python Similar Reads numpy.isreal() in Python numpy.isreal() tests element-wise whether each value in the input array is a real number (i.e., not complex). It returns a Boolean result as a boolean array. Example:Pythonimport numpy as np a = np.array([1+0j, 2+3j, 5, 4.5, 7j]) res = np.isreal(a) print(res)Output[ True False True True False] Expla 2 min read numpy.iscomplexobj() in Python numpy.iscomplexobj(array) : This logical function helps to checks for the complex type of an array or array of a complex number. Even if imaginary part is equal to zero, it is considered to be an Complex Object. Parameters : array : [array_like]Input array or object whose elements, we need to test. 1 min read numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax : numpy.isnan(array [, out]) Parameters : array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed wit 2 min read numpy.isposinf() in Python The numpy.isposinf() function tests element-wise whether it is positive infinity or not and returns the result as a boolean array. Syntax : numpy.isposinf(array, y = None) Parameters:  array : [array_like]Input array or object whose elements, we need to test for infinity. y : [array_like]A boolea 2 min read numpy.isneginf() in Python The numpy.isneginf() function tests element-wise whether it is negative infinity or not, and returns the result as a boolean array. Syntax :  numpy.isneginf(array, y = None) Parameters : array : [array_like]Input array or object whose elements, we need to test for infinity. y : [array_like]A boole 2 min read Like