NumPy Logic functions: isrealobj() function
numpy.isrealobj() function
The isrealobj() function is used to return True if x is a not complex type or an array of complex numbers.
The type of the input is checked, not the value. So even if the input has an imaginary part equal to zero,
isrealobj evaluates to False if the data type is complex.
Syntax:
numpy.isrealobj(x)
Version: 1.15.0
Parameter:
Name | Description | Required / Optional |
---|---|---|
x | The input can be of any type and shape. any |
Required |
Returns:
y: bool - The return value, False if x is of a complex type.
NumPy.isrealobj() method Example-1:
>>> import numpy as np
>>> np.isrealobj(2)
Output:
True
NumPy.isrealobj() method Example-2:
>>> import numpy as np
>>> np.isrealobj(2+0j)
Output:
False
NumPy.isrealobj() method Example-3:
>>> import numpy as np
>>> np.isrealobj([4, 1+0j, True])
Output:
False
Python - NumPy Code Editor:
Previous: isreal() function
Next: isscalar() function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework