কম্পিউটার টিউটোরিয়াল

পাইথন পান্ডাস - অর্ডার্ড ক্যাটাগরিক্যাল ইনডেক্স থেকে মিনিমাম ভ্যালু পান

পান্ডাসে অর্ডার্ড CategoricalIndex-এর min() মেথড ব্যবহার করে সর্বনিম্ন মান বের করা যায়।

প্রয়োজনীয় লাইব্রেরি ইম্পোর্ট

import pandas as pd

ক্যাটাগরিক্যাল ইনডেক্স তৈরি

catIndex = pd.CategoricalIndex(
    ["p", "q", "r", "s", "p", "q", "r", "s"],
    ordered=True,
    categories=["p", "q", "r", "s"]
)

ইনডেক্স প্রদর্শন

print("Categorical Index...\n", catIndex)

মিনিমাম ভ্যালু পাওয়া

print("\nMinimum value from CategoricalIndex...\n", catIndex.min())

সম্পূর্ণ উদাহরণ কোড

import pandas as pd

catIndex = pd.CategoricalIndex(
    ["p", "q", "r", "s", "p", "q", "r", "s"],
    ordered=True,
    categories=["p", "q", "r", "s"]
)

print("Categorical Index...\n", catIndex)
print("\nDisplaying Categories from CategoricalIndex...\n", catIndex.categories)
print("\nMinimum value from CategoricalIndex...\n", catIndex.min())

আউটপুট

Categorical Index...
CategoricalIndex(['p', 'q', 'r', 's', 'p', 'q', 'r', 's'],
                 categories=['p', 'q', 'r', 's'],
                 ordered=True,
                 dtype='category')

Displaying Categories from CategoricalIndex...
Index(['p', 'q', 'r', 's'], dtype='object')

Minimum value from CategoricalIndex...
p

নোট: ক্যাটাগরি অর্ডার অনুযায়ী p সবচেয়ে ছোট (ফার্স্ট ক্যাটাগরি), তাই মিনিমাম।

  1. পাইথন - প্যান্ডাস ইন্ডেক্সের ন্যূনতম মান ফেরত দিন

  2. পাইথন প্যান্ডাস - TimeDelta থেকে দিনের সংখ্যা পান

  3. পাইথন - প্যান্ডাসে Timestamp অবজেক্ট থেকে সপ্তাহের দিন পান

  4. Tkinter-এ চেকবক্স থেকে ইনপুট পাওয়া