यह जांचने के लिए कि क्या समान फ्लोट प्रकार के विभिन्न आकार फ्लोटिंग क्लास के उपप्रकार हैं, पायथन नम्पी में thenumpy.issubdtype() विधि का उपयोग करें। पैरामीटर dtype या ऑब्जेक्ट ज़बरदस्ती टोन हैं।
कदम
सबसे पहले, आवश्यक पुस्तकालय आयात करें -
import numpy as np
Numpy में issubdtype () विधि का उपयोग करना। विभिन्न आकारों के साथ फ़्लोटिंग पॉइंट डेटाटाइप की जांच -
print("Result...",np.issubdtype(np.float16, np.floating))
print("Result...",np.issubdtype(np.float32, np.floating))
print("Result...",np.issubdtype(np.float64, np.floating)) उदाहरण
import numpy as np
# To test whether similar float type of different sizes are subdtypes of floating class, 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 floating point datatype with different sizes
print("Result...",np.issubdtype(np.float16, np.floating))
print("Result...",np.issubdtype(np.float32, np.floating))
print("Result...",np.issubdtype(np.float64, np.floating)) आउटपुट
Using the issubdtype() method in Numpy Result... True Result... True Result... True