文件 | 函数
移位

文件

文件  copying.hpp
 用于 gather、scatter、split、slice 等操作的列 API。
 

函数

std::unique_ptr< columncudf::shift (column_view const &input, size_type offset, scalar const &fill_value, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 通过偏移量移动所有值来创建新列。 更多...
 

详细描述

函数文档

◆ shift()

std::unique_ptr<column> cudf::shift ( column_view const &  input,
size_type  offset,
scalar const &  fill_value,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

通过偏移量移动所有值来创建新列。

元素将由 output[idx] = input[idx - offset] 确定。输出中的某些元素可能无法从输入确定。对于这些元素,其值将由 fill_values 确定。

示例
-------------------------------------------------
input = [0, 1, 2, 3, 4]
offset = 3
fill_values = @
return = [@, @, @, 0, 1]
-------------------------------------------------
input = [5, 4, 3, 2, 1]
offset = -2
fill_values = 7
return = [3, 2, 1, 7, 7]
注意
如果输入是可空(nullable)的,则输出将是可空(nullable)的。
如果填充值为 null,则输出将是可空(nullable)的。
参数
input要移动的列
offset移动输入的偏移量
fill_value用于不确定输出的填充值
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回结果的设备内存的设备内存资源
异常
cudf::data_type_error如果 input 的 dtype 既不是固定宽度类型也不是字符串类型
cudf::data_type_error如果 fill_value 的 dtype 与 input 的 dtype 不匹配。
返回值
移动后的列