인덱스가 단조 감소(동일하거나 감소하는 경우에만) 값인 경우 반환하려면 index.is_monotonic_decreasing을 사용하세요. 재산.
먼저 필요한 라이브러리를 가져옵니다 -
import pandas as pd
인덱스 생성 -
index = pd.Index([50, 40, 30, 30, 30])
인덱스 표시 -
print("Pandas Index...\n",index) 인덱스가 단조 감소하는지 확인 -
print("\nIs the Pandas index monotonic decreasing?\n",index.is_monotonic_decreasing)
예
다음은 코드입니다 -
import pandas as pd
# Creating the index
index = pd.Index([50, 40, 30, 30, 30])
# Display the index
print("Pandas Index...\n",index)
# Return an array representing the data in the Index
print("\nArray...\n",index.values)
# Check if the index monotonic decreasing
print("\nIs the Pandas index monotonic decreasing?\n",index.is_monotonic_decreasing) 출력
이것은 다음 코드를 생성합니다 -
Pandas Index... Int64Index([50, 40, 30, 30, 30], dtype='int64') Array... [50 40 30 30 30] Is the Pandas index monotonic decreasing? True