

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Return True if first argument is a typecode lower/equal in type hierarchy in Python
To return True if first argument is a typecode lower/equal in type hierarchy, use the numpy.issubdtype() method in Python Numpy. The parameters are the dtype or object coercible to one
Steps
At first, import the required library −
import numpy as np
Using the issubdtype() method in Numpy −
print("Result...",np.issubdtype(np.float64, np.float32)) print("Result...",np.issubdtype(np.float64, np.floating)) print("Result...",np.issubdtype(np.float32, np.floating)) print("Result...",np.issubdtype('i4', np.signedinteger)) print("Result...",np.issubdtype('i8', np.signedinteger)) print("Result...",np.issubdtype(np.int32, np.integer))
Example
import numpy as np # To return True if first argument is a typecode lower/equal in type hierarchy, use the numpy.issubdtype() method in Python Numpy. # The parameters are the dtype or object coercible to one print("Using the issubdtype() method in Numpy\n") print("Result...",np.issubdtype(np.float64, np.float32)) print("Result...",np.issubdtype(np.float64, np.floating)) print("Result...",np.issubdtype(np.float32, np.floating)) print("Result...",np.issubdtype('i4', np.signedinteger)) print("Result...",np.issubdtype('i8', np.signedinteger)) print("Result...",np.issubdtype(np.int32, np.integer))
Output
Using the issubdtype() method in Numpy Result... False Result... True Result... True Result... True Result... True Result... True
- Related Questions & Answers
- Determine if the type in the first argument is a subclass of second in Python
- Compare and return True if a Numpy array is greater than equal to another
- Compare and return True if a Numpy array is less than equal to another
- Compare and return True if two string arrays are equal in Numpy
- Return True if all entries of two arrays are equal in Numpy
- Return True if two Numpy arrays are element-wise equal within a tolerance
- Return True if a document exists in MongoDB?
- Compare and return True if two string Numpy arrays are not equal
- Return TRUE if the first string starts with a specific second string JavaScript
- Return True if cast between scalar and data type can occur according to the casting rule in Python
- First occurrence of True number in Python
- Return True if cast between array scalar and data type can occur according to the casting rule in Python
- If ([] == false) is true, why does ([] || true) result in []? - JavaScript
- What MySQL returns if the first argument of INTERVAL() function is NULL?
- Python Pandas - Return whether any element in the index is True
Advertisements