인덱스가 0개의 요소로 비어 있는지 확인하려면 index.empty 를 사용하십시오. Pandas의 속성
먼저 필요한 라이브러리를 가져옵니다 -
import pandas as pd
인덱스 생성 -
index = pd.Index([])
인덱스 표시 -
print("Pandas Index...\n",index) 빈 인덱스 확인 -
print("\nIs the index empty?\n",index.empty)
예시
다음은 코드입니다 -
import pandas as pd
# Creating the index
index = pd.Index([])
# Display the index
print("Pandas Index...\n",index)
# Return the number of elements in the Index
print("\nNumber of elements in the index...\n",index.size)
# check for empty index
print("\nIs the index empty?\n",index.empty) 출력
이것은 다음 코드를 생성합니다 -
Pandas Index... Index([], dtype='object') Number of elements in the index... 0 Is the index empty? True