Daft icon indicating copy to clipboard operation
Daft copied to clipboard

[FEAT] Group by list columns

Open kevinzwang opened this issue 11 months ago • 0 comments

DataFrame.groupby should correctly accept list expressions.

Expected behavior:

>>> df = daft.from_pydict({
...     "strings": ["a", "b", "c", "d"],
...     "lists": [[1, 1, 1, 1], [1, 1, 1, 1], [2, 2, 2], [2, 2, 2]],
... })
>>>
>>> df.groupby('lists').agg([
...     (col("lists").alias("list_count"), 'count')
... ]).collect()

lists (Int64) | list_count (UInt64)
------------- | -----------------
[2, 2, 2]     |      2
[1, 1, 1, 1]  |      2

kevinzwang avatar Mar 06 '24 19:03 kevinzwang