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