인덱스의 조옮김을 반환하려면 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')