用法:
Index.difference(other, sort=None)
返回一个新索引,其中包含索引中不在
other
中的元素。这是两个 Index 对象的集合差。
- other:索引或array-like
- sort:假或无,默认无
是否对结果索引进行排序。默认情况下,尝试对值进行排序,但任何来自不可比较元素的 TypeError 都会被 cudf 捕获。
- 无:尝试对结果进行排序,但从比较不可比较的元素中捕获任何类型错误。
- False:不对结果进行排序。
- difference: index
参数:
返回:
例子:
>>> import cudf >>> idx1 = cudf.Index([2, 1, 3, 4]) >>> idx1 Int64Index([2, 1, 3, 4], dtype='int64') >>> idx2 = cudf.Index([3, 4, 5, 6]) >>> idx2 Int64Index([3, 4, 5, 6], dtype='int64') >>> idx1.difference(idx2) Int64Index([1, 2], dtype='int64') >>> idx1.difference(idx2, sort=False) Int64Index([2, 1], dtype='int64')
相关用法
- Python cudf.Index.is_boolean用法及代码示例
- Python cudf.Index.astype用法及代码示例
- Python cudf.Index.set_names用法及代码示例
- Python cudf.Index.is_numeric用法及代码示例
- Python cudf.Index.sort_values用法及代码示例
- Python cudf.Index.union用法及代码示例
- Python cudf.Index.is_integer用法及代码示例
- Python cudf.Index.join用法及代码示例
- Python cudf.Index.get_level_values用法及代码示例
- Python cudf.Index.isin用法及代码示例
- Python cudf.Index.rename用法及代码示例
- Python cudf.Index.to_pandas用法及代码示例
- Python cudf.Index.is_object用法及代码示例
- Python cudf.Index.from_pandas用法及代码示例
- Python cudf.Index.is_categorical用法及代码示例
- Python cudf.Index.append用法及代码示例
- Python cudf.Index.is_interval用法及代码示例
- Python cudf.Index.intersection用法及代码示例
- Python cudf.Index.is_floating用法及代码示例
- Python cudf.Index.fillna用法及代码示例
注:本文由纯净天空筛选整理自rapids.ai大神的英文原创作品 cudf.Index.difference。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。