ভূমিকা
NumPy-এর numpy.min_scalar_type() মেথড একটি স্কেলার মান ধারণ করতে সক্ষম সবচেয়ে ছোট ডেটা টাইপ রিটার্ন করে। ফ্লোটিং পয়েন্ট মান ইন্টিজারে ডিমোট করা হয় না, কমপ্লেক্স মান ফ্লোটে ডিমোট করা হয় না। নন-স্কেলার অ্যারের জন্য এর dtype অপরিবর্তিত রিটার্ন করা হয়।
ধাপসমূহ
- লাইব্রেরি আমদানি:
import numpy as np - বিভিন্ন মানের জন্য ন্যূনতম ডেটা টাইপ প্রিন্ট:
print("Using the min_scalar() method in Numpy\n") print("Result...", np.min_scalar_type(55)) print("Result...", np.min_scalar_type(38.9)) print("Result...", np.min_scalar_type(-78)) print("Result...", np.min_scalar_type(479)) print("Result...", np.min_scalar_type(2e100)) print("Result...", np.min_scalar_type(-45.8)) print("Result...", np.min_scalar_type(6.5e100))
সম্পূর্ণ উদাহরণ
import numpy as np
print("Using the min_scalar() method in Numpy\n")
print("Result...", np.min_scalar_type(55))
print("Result...", np.min_scalar_type(38.9))
print("Result...", np.min_scalar_type(-78))
print("Result...", np.min_scalar_type(479))
print("Result...", np.min_scalar_type(2e100))
print("Result...", np.min_scalar_type(-45.8))
print("Result...", np.min_scalar_type(6.5e100))
আউটপুট
Using the min_scalar() method in Numpy
Result... uint8
Result... float16
Result... int8
Result... uint16
Result... float64
Result... float16
Result... float64