- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Test whether int datatype of different sizes are not subdtypes of each other in Python
# To check whether int data types of different sizes are not subdtypes of each other, 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. Checking for int datatype with different sizes −
print("Result...",np.issubdtype(np.int16, np.int32)) print("Result...",np.issubdtype(np.int32, np.int16)) print("Result...",np.issubdtype(np.int64, np.int32)) print("Result...",np.issubdtype(np.int32, np.int64)) print("Result...",np.issubdtype(np.int16, np.int64)) print("Result...",np.issubdtype(np.int64, np.int16))
Example
import numpy as np # To check whether int data types of different sizes are not subdtypes of each other, 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") # Checking for int datatype with different sizes print("Result...",np.issubdtype(np.int16, np.int32)) print("Result...",np.issubdtype(np.int32, np.int16)) print("Result...",np.issubdtype(np.int64, np.int32)) print("Result...",np.issubdtype(np.int32, np.int64)) print("Result...",np.issubdtype(np.int16, np.int64)) print("Result...",np.issubdtype(np.int64, np.int16))
Output
Using the issubdtype() method in Numpy Result... False Result... False Result... False Result... False Result... False Result... False
Advertisements