Python Pandas Index.flags

Python Pandas Index.flags

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

Pandas Index.flags属性返回给定索引对象的所有标志的状态。

语法: Index.flags

参数:

返回:标志的状态

示例#1:使用Index.flags属性来查找给定索引对象的所有标志的状态。

# importing pandas as pd
import pandas as pd
  
# Creating the index
idx = pd.Index(['Jan', 'Feb', 'Mar', 'Apr', 'May'])
  
# Print the index
print(idx)

现在我们将使用Index.flags属性来查找给定索引对象的所有标志的状态。

# return the status of the flags
result = idx.flags
  
# Print the result
print(result)

正如我们在输出中看到的,Index.flags属性已经返回了给定Index对象的所有标志的状态。

示例#2 :使用Index.flags属性来查找给定索引对象的所有标志的状态。

# importing pandas as pd
import pandas as pd
  
# Creating the index
idx = pd.Index([100, 200, 142, 88, 124])
  
# Print the index
print(idx)

现在我们将使用Index.flags属性来查找给定索引对象的所有标志的状态。

# return the status of the flags
result = idx.flags
  
# Print the result
print(result)

正如我们在输出中看到的,Index.flags属性已经返回了给定Index对象的所有标志的状态。

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程