复制移位#

group copy_shift

函数

std::unique_ptr<column> 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 决定。

Examples
-------------------------------------------------
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]

注意

如果输入可为空,则输出也将可为空。

注意

如果填充值为null,输出将可为空。

Parameters:
  • input – 要移动的列

  • offset – 用于移动输入的偏移量

  • fill_value – 用于不可确定输出的填充值

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

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

Throws:
  • cudf::data_type_error – 如果 input 的数据类型既不是固定宽度也不是字符串类型

  • cudf::data_type_error – 如果 fill_value 的数据类型与 input 的数据类型不匹配。

Returns:

移动后的列