अनुक्रमणिका के स्थानान्तरण को वापस करने के लिए, index.T . का उपयोग करें संपत्ति।
सबसे पहले, आवश्यक पुस्तकालयों को आयात करें -
import pandas as pd
अनुक्रमणिका बनाना -
index = pd.Index(['Car','Bike','Truck','Ship','Airplane'])
सूचकांक प्रदर्शित करें -
print("Pandas Index...\n",index) सूचकांक का स्थानान्तरण प्रदर्शित करें -
print("\nTranspose of the Pandas Index which is by definition self...\n",index.T)
उदाहरण
निम्नलिखित कोड है -
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 which is by definition self...\n",index.T) आउटपुट
यह निम्नलिखित कोड उत्पन्न करेगा -
Pandas Index... Index(['Car', 'Bike', 'Truck', 'Ship', 'Airplane'], dtype='object') Array... ['Car' 'Bike' 'Truck' 'Ship' 'Airplane'] Transpose of the Pandas Index which is by definition self... Index(['Car', 'Bike', 'Truck', 'Ship', 'Airplane'], dtype='object')