পান্ডাসে অনুরোধ করা লেবেলের জন্য পূর্ণসংখ্যার অবস্থান পেতে, index.get_loc() ব্যবহার করুন পদ্ধতি প্রথমে, প্রয়োজনীয় লাইব্রেরিগুলি আমদানি করুন -
import pandas as pd
পান্ডাস ইনডেক্স অবজেক্ট −
তৈরি করুনindex = pd.Index(list('pqrstuvwxyz'))
পান্ডাস সূচক প্রদর্শন করুন -
print("Pandas Index...\n",index) প্রদত্ত সূচক -
থেকে পূর্ণসংখ্যার অবস্থান পানprint("\nDisplay integer location from given index...\n",index.get_loc('w'))
print("\nDisplay integer location from given index...\n",index.get_loc('z')) উদাহরণ
নিম্নলিখিত কোড -
import pandas as pd
# create Pandas index object
index = pd.Index(list('pqrstuvwxyz'))
# Display the Pandas index
print("Pandas Index...\n",index)
# Return the number of elements in the Index
print("\nNumber of elements in the index...\n",index.size)
# get integer location from the given index
print("\nDisplay integer location from given index...\n",index.get_loc('w'))
print("\nDisplay integer location from given index...\n",index.get_loc('z')) আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেPandas Index... Index(['p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], dtype='object') Number of elements in the index... 11 Display integer location from given index... 7 Display integer location from given index... 10