

- 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
Test whether float datatype of different sizes are not subdtypes of each other in Python
To check whether float 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 float datatype with different sizes −
print("Result...",np.issubdtype(np.float16, np.float32)) print("Result...",np.issubdtype(np.float32, np.float16)) print("Result...",np.issubdtype(np.float64, np.float32)) print("Result...",np.issubdtype(np.float32, np.float64)) print("Result...",np.issubdtype(np.float16, np.float64)) print("Result...",np.issubdtype(np.float64, np.float16))
Example
import numpy as np # To check whether float 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 float datatype with different sizes print("Result...",np.issubdtype(np.float16, np.float32)) print("Result...",np.issubdtype(np.float32, np.float16)) print("Result...",np.issubdtype(np.float64, np.float32)) print("Result...",np.issubdtype(np.float32, np.float64)) print("Result...",np.issubdtype(np.float16, np.float64)) print("Result...",np.issubdtype(np.float64, np.float16))
Output
Using the issubdtype() method in Numpy Result... False Result... False Result... False Result... False Result... False Result... False
- Related Questions & Answers
- Test whether int datatype of different sizes are not subdtypes of each other in Python
- Test whether similar data types of different sizes are not subdtypes of each other in Python
- Test whether similar float type of different sizes are subdtypes of floating class in Python
- Test whether similar int type of different sizes are subdtypes of integer class in Python
- Check whether two strings are anagram of each other in Python
- Check if strings are rotations of each other or not in Python
- Program to check strings are rotation of each other or not in Python
- A Program to check if strings are rotations of each other or not?
- Check if bits in range L to R of two numbers are complement of each other or not in Python
- Program to check whether one tree is subtree of other or not in Python
- Number of Ways to Wear Different Hats to Each Other in C++
- Python Program to test whether the length of rows are in increasing order
- Check if all rows of a matrix are circular rotations of each other in Python
- Merge k sorted arrays of different sizes in C++
- Python – Test if elements of list are in Min/Max range from other list
Advertisements