পাইথন নামপাই-তে numpy.issctype() মেথড ব্যবহার করে প্রদত্ত অবজেক্টটি স্কেলার ডেটা টাইপ (scalar dtype) প্রতিনিধিত্ব করে কিনা তা নির্ধারণ করা যায়। এটি বুলিয়ান ফলাফল ফেরত দেয়।
- যদি
repস্কেলার dtype-এর ইনস্ট্যান্স হয়, তবেTrueফেরত দেয়। - অন্যথায়
Falseফেরত দেয়।
প্যারামিটার
- rep: যাচাই করার অবজেক্ট
পদ্ধতি
লাইব্রেরি ইম্পোর্ট করুন
import numpy as np
issctype() মেথড দিয়ে বিভিন্ন অবজেক্ট যাচাই করুন
print("ফলাফল...", np.issctype(np.int32))
print("ফলাফল...", np.issctype(np.int64))
print("ফলাফল...", np.issctype(np.dtype('str')))
print("ফলাফল...", np.issctype(100))
print("ফলাফল...", np.issctype(25.9))
print("ফলাফল...", np.issctype(np.float32(22.3)))
সম্পূর্ণ উদাহরণ
import numpy as np
print("Numpy-এ issctype() মেথড ব্যবহার\n")
print("ফলাফল...", np.issctype(np.int32))
print("ফলাফল...", np.issctype(np.int64))
print("ফলাফল...", np.issctype(np.dtype('str')))
print("ফলাফল...", np.issctype(100))
print("ফলাফল...", np.issctype(25.9))
print("ফলাফল...", np.issctype(np.float32(22.3)))
আউটপুট
Numpy-এ issctype() মেথড ব্যবহার
ফলাফল... True
ফলাফল... True
ফলাফল... True
ফলাফল... False
ফলাফল... False
ফলাফল... False
ব্যাখ্যা:
np.int32,np.int64,np.dtype('str')— এগুলো স্কেলার dtype অবজেক্ট/টাইপ, তাইTrue100(পাইথন int),25.9(পাইথন float),np.float32(22.3)(নামপাই স্কেলার ইনস্ট্যান্স) — এগুলো dtype নয়, বরং মান (value), তাইFalse