অন্তর্নিহিত ডেটার dtype অবজেক্ট ফেরত দিতে, index.dtype ব্যবহার করুন পান্ডাসে সম্পত্তি।
প্রথমে, প্রয়োজনীয় লাইব্রেরিগুলি আমদানি করুন -
import pandas as pd
সূচক তৈরি করা হচ্ছে -
index = pd.Index(['Car','Bike', 'Shop','Car','Airplace', 'Truck'])
সূচক প্রদর্শন করুন -
print("Pandas Index...\n",index) ডেটার টাইপ −
ফেরত দিনprint("\nThe dtype object...\n",index.dtype)
উদাহরণ
নিম্নলিখিত কোড -
import pandas as pd
# Creating the index
index = pd.Index(['Car','Bike', 'Shop','Car','Airplace', 'Truck'])
# Display the index
print("Pandas Index...\n",index)
# Return an array representing the data in the Index
print("\nArray...\n",index.values)
# Return the dtype of the data
print("\nThe dtype object...\n",index.dtype)
# Return a tuple of the shape of the underlying data
print("\nA tuple of the shape of underlying data...\n",index.shape) আউটপুট
এটি নিম্নলিখিত কোড তৈরি করবে -
Pandas Index... Index(['Car', 'Bike', 'Shop', 'Car', 'Airplace', 'Truck'], dtype='object') Array... ['Car' 'Bike' 'Shop' 'Car' 'Airplace' 'Truck'] The dtype object... object A tuple of the shape of underlying data... (6,)