Skip to content

pd.Index.difference

pandasIndex.difference(other, sort=None)

支持的参数:

  • other: 可以是一个索引、序列或具有匹配类型的 1 维 numpy 数组

支持的索引类型

  • 数字索引
  • 字符串索引
  • 二进制索引
  • 范围索引
  • 日期时间索引
  • 时间差索引

重要

Bodo 在 Index.difference() 上与 Pandas API 有几个不同之处:元素的顺序可能不同,并且总是返回 NumericIndex 而不是 RangeIndex。

示例用法

>>> @bodo.jit(distributed=["I", "J"])
... def f(I, J):
...    return I.difference(J)

>>> I = pd.Index([1, 2, 3, 4, 5])
>>> J = pd.Index([2, 4, 6, 8, 10, 12])
>>> f(I, J)
Int64Index([1, 3, 5], dtype='int64')