পাইথন নামপাই-তে numpy.maximum_sctype() মেথড ব্যবহার করে ইনপুট ডেটা টাইপের কাইন্ড (kind)-এর মতো সর্বোচ্চ প্রিসিশনের (precision) স্কেলার টাইপ ফেরত দেওয়া যায়।
প্যারামিটার
- dtype: ইনপুট ডেটা টাইপ। এটি dtype অবজেক্ট বা dtype-এ কনভার্টযোগ্য অবজেক্ট হতে পারে।
পদ্ধতি
লাইব্রেরি ইম্পোর্ট করুন
import numpy as np
maximum_sctype() মেথড দিয়ে সর্বোচ্চ প্রিসিশন টাইপ বের করুন
print("ফলাফল...", np.maximum_sctype(int))
print("ফলাফল...", np.maximum_sctype(np.uint8))
print("ফলাফল...", np.maximum_sctype(complex))
print("ফলাফল...", np.maximum_sctype(str))
print("ফলাফল...", np.maximum_sctype('f4'))
print("ফলাফল...", np.maximum_sctype('i2'))
print("ফলাফল...", np.maximum_sctype('i4'))
print("ফলাফল...", np.maximum_sctype('i8'))
সম্পূর্ণ উদাহরণ
import numpy as np
print("Numpy-এ maximum_sctype() মেথড ব্যবহার\n")
print("ফলাফল...", np.maximum_sctype(int))
print("ফলাফল...", np.maximum_sctype(np.uint8))
print("ফলাফল...", np.maximum_sctype(complex))
print("ফলাফল...", np.maximum_sctype(str))
print("ফলাফল...", np.maximum_sctype('f4'))
print("ফলাফল...", np.maximum_sctype('i2'))
print("ফলাফল...", np.maximum_sctype('i4'))
print("ফলাফল...", np.maximum_sctype('i8'))
আউটপুট
Numpy-এ maximum_sctype() মেথড ব্যবহার
ফলাফল...
ফলাফল...
ফলাফল...
ফলাফল...
ফলাফল...
ফলাফল...
ফলাফল...
ফলাফল...
ব্যাখ্যা:
int(সাইনড ইন্টিজার) →int64(সর্বোচ্চ প্রিসিশন)uint8(অনসাইনড ইন্টিজার) →uint64complex→complex256(সর্বোচ্চ প্রিসিশন কমপ্লেক্স)str→str_(নামপাই স্ট্রিং টাইপ)'f4'(float32) →float128(সর্বোচ্চ প্রিসিশন ফ্লোট)'i2','i4','i8'(সাইনড ইন্টিজার) → সবইint64