Lists Elements#

group lists_elements

Functions

std::unique_ptr<column> count_elements(lists_column_view const &input, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#

Returns a numeric column containing the number of rows in each list element in the given lists column.

The output column will have the same number of rows as the input lists column. Each output[i] will be input[i].size().

l = { {1, 2, 3}, {4}, {5, 6} }
r = count_elements(l)
r is now {3, 1, 2}

Any null input element will result in a corresponding null entry in the output column.

Parameters:
  • input – Input lists column

  • stream – CUDA stream used for device memory operations and kernel launches

  • mr – Device memory resource used to allocate the returned column’s device memory

Returns:

New column with the number of elements for each row