cudf.core.column.lists.ListMethods.concat#

ListMethods.concat(dropna=True) Series | Index[source]#

For a column with at least one level of nesting, concatenate the lists in each row.

Parameters:
dropna: bool, optional

If True (default), ignores top-level null elements in each row. If False, and top-level null elements are present, the resulting row in the output is null.

Returns:
Series or Index

Examples

>>> s1
0      [[1.0, 2.0], [3.0, 4.0, 5.0]]
1    [[6.0, None], [7.0], [8.0, 9.0]]
dtype: list
>>> s1.list.concat()
0    [1.0, 2.0, 3.0, 4.0, 5.0]
1    [6.0, None, 7.0, 8.0, 9.0]
dtype: list

Null values at the top-level in each row are dropped by default:

>>> s2
0    [[1.0, 2.0], None, [3.0, 4.0, 5.0]]
1        [[6.0, None], [7.0], [8.0, 9.0]]
dtype: list
>>> s2.list.concat()
0    [1.0, 2.0, 3.0, 4.0, 5.0]
1    [6.0, None, 7.0, 8.0, 9.0]
dtype: list

Use dropna=False to produce a null instead:

>>> s2.list.concat(dropna=False)
0                         None
1    [6.0, nan, 7.0, 8.0, 9.0]
dtype: list