Daft icon indicating copy to clipboard operation
Daft copied to clipboard

Add a .list.apply() expression

Open MisterKloudy opened this issue 5 months ago • 1 comments

Would apply a function on each element in the list

Example:

df = daft.from_pydict({"a": [["HeLLo WoRlD", "Hi", "WelCoMe"], ["tO", "a New WoRlD"]]})
df.with_column("b", col("a").list.apply(element().str.lower())).select("b").show()

Expected output:

╭─────────────╮
│ b           │ 
│ ---         │
│ List[Struct[value: Utf8, count: Int32]] │
╞═════════════╡
│ [["hello world", "hi", "welcome"]]   │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ["to", "a new world"]   │
╰─────────────╯

(Showing first 2 of 2 rows)

MisterKloudy avatar Sep 25 '24 05:09 MisterKloudy