Daft
Daft copied to clipboard
[FEAT] Group by list columns
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