复制偏移#

偏移

函数

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,则输出将可为空。

参数:
  • input – 要偏移的列

  • offset – 移动输入的偏移量

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

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

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

抛出:
返回:

偏移后的列