Python Pandas Index.is_monotonic_decreasing

Python Pandas Index.is_monotonic_decreasing

Pandas Index是一个不可变的ndarray,实现了一个有序的、可切分的集合。它是存储所有pandas对象的轴标签的基本对象。

Pandas Index.is_monotonic_decreasing属性,如果给定索引对象中的基础数据是单调递减的,则返回True,否则返回False。

语法: Index.is_monotonic_decreasing

参数:

返回 : 布尔值

例子#1:使用Index.is_monotonic_decreasing属性来找出给定Index对象中的基础数据是否是单调递减。

# importing pandas as pd
import pandas as pd
  
# Creating the index
idx = pd.Index([900, 700, 620, 388, 24])
  
# Print the index
print(idx)

输出 :
Python Pandas Index.is_monotonic_decreasing

现在我们将使用Index.is_monotonic_decreasing属性来找出给定Index对象中的基础数据是否是单调递减的。

# check if the values in the Index
# are monotonically decreasing 
result = idx.is_monotonic_decreasing
  
# Print the result
print(result)

输出 :
Python Pandas Index.is_monotonic_decreasing
正如我们在输出中看到的,Index.is_monotonic_decreasing属性返回了True,表明给定Index对象的基础数据是单调递减的。

例子#2 :使用Index.is_monotonic_decreasing属性来找出给定Index对象中的基础数据是否是单调递减。

# importing pandas as pd
import pandas as pd
  
# Creating the index
idx = pd.Index(['2012-12-12', None, '2002-1-10', None])
  
# Print the index
print(idx)

输出 :
Python Pandas Index.is_monotonic_decreasing

现在我们将使用Index.is_monotonic_decreasing属性来找出给定Index对象中的基础数据是否是单调递减的。

# check if the values in the Index
# are monotonically decreasing 
result = idx.is_monotonic_decreasing
  
# Print the result
print(result)

输出 :
Python Pandas Index.is_monotonic_decreasing
正如我们在输出中看到的,Index.is_monotonic_decreasing属性返回了False,表明给定Index对象的基础数据不是单调递减的。

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程