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.
Return :
True, if the input array has a complex element; otherwise False
Code 1 :
# Python program explaining # iscomplexobj() function import numpy as np in_array = [1, 3, 5, 4] print ("Input array : ", in_array) output_value = np.iscomplexobj(in_array) print ("\nIs complex : ", output_value) |
Output :
Input array : [1, 3, 5, 4] Is complex : False
Code 2 :
# Python Program illustrating # numpy.iscomplexobj() method import numpy as geek # Returns True/False value for each element a = geek.arange(20).reshape(5, 4) print("Is complex : \n", geek.iscomplexobj(a)) # Returns True/False value as ans # because we have mentioned dtpe in the begining b = geek.arange(20).reshape(5, 4).dtype = complex print("\n",b) print("\nIs complex : ", geek.iscomplexobj(b)) b = [[1j], [3]] print("\nIs complex : \n", geek.iscomplexobj(b)) |
Output :
Is complex : False class 'complex' Is complex : False Is complex : True
References :
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.iscomplexobj.html#numpy.iscomplexobj
.
Recommended Posts:
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Python - Read blob object in python using wand library
- Reading Python File-Like Objects from C | Python
- Python | PRAW - Python Reddit API Wrapper
- Python | Index of Non-Zero elements in Python list
- Important differences between Python 2.x and Python 3.x with examples
- Python | Merge Python key values to list
- MySQL-Connector-Python module in Python
- twitter-text-python (ttp) module - Python
- Python | Convert list to Python array
- Python | Add Logging to a Python Script
- Python | Add Logging to Python Libraries
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- Python | Visualizing O(n) using Python
- JavaScript vs Python : Can Python Overtop JavaScript by 2020?
- chr() in Python
- Python PIP
- abs() in Python
- Python Set | pop()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

