列重塑#
- group column_reshape
-
函数
-
std::unique_ptr<table> explode(table_view const &input_table, size_type explode_column_idx, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
展开列表列的元素。
任何列表都会被展开,这意味着每行中的列表元素会被扩展为输出中的新行。输入中其他列的对应行会被复制。示例:
[[5,10,15], 100], [[20,25], 200], [[30], 300], returns [5, 100], [10, 100], [15, 100], [20, 200], [25, 200], [30, 300],
空值和空列表的传播方式不同,取决于什么是空或空。
Note that null lists are not included in the resulting table, but nulls inside lists and empty lists will be represented with a null entry for that column in that row.[[5,null,15], 100], [null, 200], [[], 300], returns [5, 100], [null, 100], [15, 100],
- Parameters:
input_table – 要展开的表。
explode_column_idx – 表中要展开的列索引。
stream – 用于设备内存操作和内核启动的CUDA流。
mr – 用于分配返回列的设备内存的设备内存资源。
- Returns:
一个新的表格,其中explode_col已被展开。
-
std::unique_ptr<table> explode_position(table_view const &input_table, size_type explode_column_idx, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
展开列表列的元素并包含一个位置列。
任何列表都会被展开,这意味着列表中每一行的元素都会被扩展为输出中的新行。输入中其他列的对应行会被复制。会添加一个位置列,该列包含每行在原始列表中的索引。示例:
[[5,10,15], 100], [[20,25], 200], [[30], 300], returns [0, 5, 100], [1, 10, 100], [2, 15, 100], [0, 20, 200], [1, 25, 200], [0, 30, 300],
空值和空列表的传播方式不同,取决于什么是空或空。
Note that null lists are not included in the resulting table, but nulls inside lists and empty lists will be represented with a null entry for that column in that row.[[5,null,15], 100], [null, 200], [[], 300], returns [0, 5, 100], [1, null, 100], [2, 15, 100],
- Parameters:
input_table – 要展开的表。
explode_column_idx – 表中要展开的列索引。
stream – 用于设备内存操作和内核启动的CUDA流。
mr – 用于分配返回列的设备内存的设备内存资源。
- Returns:
一个新的表格,包含展开的值和位置。返回表格的列顺序是[展开输入前的列,展开位置,展开值,展开输入后的列]。
-
std::unique_ptr<table> explode_outer(table_view const &input_table, size_type explode_column_idx, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
展开列表列的元素,保留其中的任何空条目或空列表。
任何列表都会被展开,这意味着每行中的列表元素会被扩展为输出中的新行。输入中其他列的对应行会被复制。示例:
[[5,10,15], 100], [[20,25], 200], [[30], 300], returns [5, 100], [10, 100], [15, 100], [20, 200], [25, 200], [30, 300],
空值和空列表在结果中传播为 null 条目。
[[5,null,15], 100], [null, 200], [[], 300], returns [5, 100], [null, 100], [15, 100], [null, 200], [null, 300],
- Parameters:
input_table – 要展开的表。
explode_column_idx – 表中要展开的列索引。
stream – 用于设备内存操作和内核启动的CUDA流。
mr – 用于分配返回列的设备内存的设备内存资源。
- Returns:
一个新的表格,其中explode_col已被展开。
-
std::unique_ptr<table> explode_outer_position(table_view const &input_table, size_type explode_column_idx, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
展开列表列的元素,保留任何空条目或空列表,并包括一个位置列。
任何列表都会被展开,这意味着列表中每一行的元素都会被扩展为输出中的新行。输入中其他列的对应行会被复制。会添加一个位置列,该列包含每行在原始列表中的索引。示例:
[[5,10,15], 100], [[20,25], 200], [[30], 300], returns [0, 5, 100], [1, 10, 100], [2, 15, 100], [0, 20, 200], [1, 25, 200], [0, 30, 300],
空值和空列表在结果中作为空条目传播。
[[5,null,15], 100], [null, 200], [[], 300], returns [0, 5, 100], [1, null, 100], [2, 15, 100], [0, null, 200], [0, null, 300],
- Parameters:
input_table – 要展开的表。
explode_column_idx – 表中要展开的列索引。
stream – 用于设备内存操作和内核启动的CUDA流。
mr – 用于分配返回列的设备内存的设备内存资源。
- Returns:
一个新的表格,其中explode_col已被展开。
-
std::unique_ptr<column> interleave_columns(table_view const &input, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
将表格的列交错排列成单列。
将列主表
input转换为行主列。示例:in = [[A1, A2, A3], [B1, B2, B3]] return = [A1, B1, A2, B2, A3, B3]
- Throws:
cudf::logic_error – 如果输入不包含任何列。
cudf::logic_error – 如果输入列的数据类型不一致。
- Parameters:
input – 包含要交错列的表格
stream – 用于设备内存操作和内核启动的CUDA流
mr – 用于分配返回列的设备内存的设备内存资源
- Returns:
交错列作为单列
-
std::unique_ptr<table> tile(table_view const &input, size_type count, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
将
input表中的行重复count次以形成新表。output.num_columns() == input.num_columns()output.num_rows() == input.num_rows() * countinput = [[8, 4, 7], [5, 2, 3]] count = 2 return = [[8, 4, 7, 8, 4, 7], [5, 2, 3, 5, 2, 3]]
- Parameters:
input – 包含要重复行的表
count – 平铺“行”的次数。必须为非负数
stream – 用于设备内存操作和内核启动的CUDA流
mr – 用于分配返回表的设备内存的设备内存资源
- Returns:
包含平铺“行”的表格
-
std::unique_ptr<column> byte_cast(column_view const &input_column, flip_endianness endian_configuration, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
将列的元素转换为字节列表。
input<int32> = [8675, 309] configuration = flip_endianness::YES return = [[0x00, 0x00, 0x21, 0xe3], [0x00, 0x00, 0x01, 0x35]]
- Parameters:
input_column – 要转换为字节列表的列
endian_configuration – 是否保留或翻转元素的字节序
stream – 用于设备内存操作和内核启动的CUDA流
mr – 用于分配返回列的设备内存的设备内存资源
- Returns:
包含字节列表的列
-
std::unique_ptr<table> explode(table_view const &input_table, size_type explode_column_idx, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#