跳到主要内容
Ctrl+K
cudf 25.04.00 documentation - Home cudf 25.04.00 documentation - Home
  • cuDF 用户指南
  • cudf.pandas
  • Polars GPU 引擎
  • pylibcudf 文档
  • libcudf 文档
    • 开发者指南
  • GitHub
  • Twitter
主页
cudf
cucimcudf-javacudfcugraphcumlcuprojcuspatialcuvscuxfilterdask-cudadask-cudfkvikiolibcudflibcumllibcuprojlibcuspatiallibkvikiolibrmmlibucxxraftrapids-cmakerapidsmpfrmm
稳定版 (25.04)
夜间版 (25.06)稳定版 (25.04)旧版 (25.02)
  • cuDF 用户指南
  • cudf.pandas
  • Polars GPU 引擎
  • pylibcudf 文档
  • libcudf 文档
  • 开发者指南
  • GitHub
  • Twitter

章节导航

目录

  • libcudf 文档
    • libcudf
    • 默认流
    • 内存资源管理
    • Cudf 类
      • 列类
        • 列工厂
        • 字典类
        • 列表类
        • 字符串类
        • 结构体类
        • 时间戳类
      • 表类
      • 标量类
        • 标量工厂
      • 定点数类
    • 列 API
      • 列复制
        • 复制连接
        • 复制收集
        • 复制分散
        • 复制切片
        • 复制分割
        • 复制移位
      • 列空值掩码
      • 列排序
      • 列搜索
      • 列哈希
      • 列合并
      • 列联接
      • 列分位数
      • 列聚合
        • 聚合工厂
        • 聚合规约
        • 聚合分组
        • 聚合窗口计算
      • 列转换
        • 转换一元操作
        • 转换二元操作
        • 转换操作
        • 转换替换
        • 转换填充
      • 列重塑
        • 重塑转置
      • 列重排
        • 重排分区
        • 重排紧凑
      • 列互操作
        • 互操作 Dlpack
        • 互操作 Arrow
    • 日期时间 API
      • 日期时间提取
      • 日期时间计算
    • 字符串 API
      • 字符串大小写
      • 字符串类型
      • 字符串组合
      • 字符串包含
      • 字符串转换
      • 字符串复制
      • 字符串切片
      • 字符串查找
      • 字符串修改
      • 字符串替换
      • 字符串分割
      • 字符串提取
      • 字符串正则表达式
    • 字典 API
      • 字典编码
      • 字典搜索
      • 字典更新
    • Io API
      • Io 类型
      • Io 读取器
      • Io 写入器
      • Io 数据源
      • Io 数据汇
    • JSON API
      • JSON 对象
    • 列表 API
      • 列表组合
      • 列表修改
      • 列表提取
      • 列表填充
      • 列表包含
      • 列表收集
      • 列表元素
      • 列表过滤
      • 列表排序
      • 集合操作
    • Nvtext API
      • Nvtext N-gram
      • Nvtext 规范化
      • Nvtext 词干提取
      • Nvtext 编辑距离
      • Nvtext 分词
      • Nvtext 替换
      • Nvtext Minhash
      • Nvtext Jaccard
    • 实用工具 API
      • 实用工具类型
      • 实用工具调度器
      • 实用工具位掩码
      • 实用工具错误
      • 实用工具Span
    • 标注 API
      • 标注分箱
    • 表达式求值
    • tdigest
  • 正则表达式特性
  • Unicode 限制
  • libcudf 文档
  • libcudf 文档
  • 列 API
  • 列搜索

列搜索#

组 搜索

函数

std::unique_ptr<column> lower_bound(table_view const &haystack, table_view const &needles, std::vector<order> const &column_order, std::vector<null_order> const &null_precedence, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

在已排序的表中查找应插入值以保持顺序的最小索引。

对于 needles 中的每一行,在 haystack 中找到插入该行后仍能保持其排序顺序的第一个索引。

Example:

 Single column:
     idx        0   1   2   3   4
  haystack = { 10, 20, 20, 30, 50 }
  needles  = { 20 }
  result   = {  1 }

 Multi Column:
     idx          0    1    2    3    4
  haystack = {{  10,  20,  20,  20,  20 },
              { 5.0,  .5,  .5,  .7,  .7 },
              {  90,  77,  78,  61,  61 }}
  needles  = {{ 20 },
              { .7 },
              { 61 }}
  result   = {   3 }
参数:
  • haystack – 包含搜索空间的表

  • needles – 要查找其在搜索空间中插入位置的值

  • column_order – 列排序顺序的向量

  • null_precedence – null_precedence 枚举的向量

  • stream – 用于设备内存操作和内核启动的 CUDA 流

  • mr – 用于分配返回列的设备内存的设备内存资源

返回:

一个包含插入点的非可空元素列

std::unique_ptr<column> upper_bound(table_view const &haystack, table_view const &needles, std::vector<order> const &column_order, std::vector<null_order> const &null_precedence, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

在已排序的表中查找应插入值以保持顺序的最大索引。

对于 needles 中的每一行,在 haystack 中找到插入该行后仍能保持其排序顺序的最后一个索引。

Example:

 Single Column:
     idx        0   1   2   3   4
  haystack = { 10, 20, 20, 30, 50 }
  needles  = { 20 }
  result   = {  3 }

 Multi Column:
     idx          0    1    2    3    4
  haystack = {{  10,  20,  20,  20,  20 },
              { 5.0,  .5,  .5,  .7,  .7 },
              {  90,  77,  78,  61,  61 }}
  needles  = {{ 20 },
              { .7 },
              { 61 }}
  result =     { 5 }
参数:
  • haystack – 包含搜索空间的表

  • needles – 要查找其在搜索空间中插入位置的值

  • column_order – 列排序顺序的向量

  • null_precedence – null_precedence 枚举的向量

  • stream – 用于设备内存操作和内核启动的 CUDA 流

  • mr – 用于分配返回列的设备内存的设备内存资源

返回:

一个包含插入点的非可空元素列

bool contains(column_view const &haystack, scalar const &needle, rmm::cuda_stream_view stream = cudf::get_default_stream())#

检查给定的 needle 值是否存在于 haystack 列中。

Single Column:
 idx           0   1   2   3   4
 haystack = { 10, 20, 20, 30, 50 }
 needle   = { 20 }
 result   = true

抛出异常:

cudf::logic_error – 如果 haystack.type() != needle.type()。

参数:
  • haystack – 包含搜索空间的列

  • needle – 要检查其在搜索空间中是否存在性的标量值

  • stream – 用于设备内存操作和内核启动的 CUDA 流

返回:

如果给定的 needle 值存在于 haystack 列中,则为 true

std::unique_ptr<column> contains(column_view const &haystack, column_view const &needles, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

检查给定的 needles 值是否存在于 haystack 列中。

新列的类型将为 BOOL,并且具有与输入 needles 列相同的尺寸和空值掩码。也就是说,needles 列中的任何空行都会导致输出列中也出现空行。

haystack = { 10, 20, 30, 40, 50 }
needles  = { 20, 40, 60, 80 }
result   = { true, true, false, false }

抛出异常:

cudf::logic_error – 如果 haystack.type() != needles.type()

参数:
  • haystack – 包含搜索空间的列

  • needles – 要检查其在搜索空间中是否存在性的值列

  • stream – 用于设备内存操作和内核启动的 CUDA 流

  • mr – 用于分配返回列的设备内存的设备内存资源

返回:

一个 BOOL 列,指示 needles 中的每个元素是否存在于搜索空间中

上一页

列排序

下一页

列哈希

在本页
  • lower_bound()
  • upper_bound()
  • contains()
  • contains()

本页

  • 显示源

© Copyright 2018-2025, NVIDIA Corporation.

使用 Sphinx 8.2.3 创建。

使用 PyData Sphinx Theme 0.16.1 构建。