目录

搜索

输入搜索字词或模块,类或函数名称。

pandas.CategoricalIndex.difference

CategoricalIndex.difference(other)[source]

返回索引中不在其他中的元素的新索引。

这是两个Index对象的设置差异。如果排序是可能的,它被排序。

参数:其他:索引或数组类
返回:difference:索引

例子

>>> idx1 = pd.Index([1, 2, 3, 4])
>>> idx2 = pd.Index([3, 4, 5, 6])
>>> idx1.difference(idx2)
Int64Index([1, 2], dtype='int64')
Scroll To Top