3 ms·
Seems that for that case you would need to use `mutate_with`, which as you say does pass data between systems. My understanding is you can use any Series opera
by bongobingo1 3y ago
Seems that for that case you would need to use `mutate_with`, which as you say does pass data between systems.
My understanding is you can use any Series operations without penalty (ie. they get passed into some rust NIF call), https://hexdocs.pm/explorer/Explorer.Series.html#functions-string-ops https://hexdocs.pm/explorer/Explorer.Series.html#functions-s..., which does include whitespace trimming, but not arbitrary strings, but I imagine it wouldn't be too much of a jump to add arbitrary constant strings. Might just need to expose `str.slice` or `str.replace`.
The docs do imply that `mutate_with` operates lazily, so you only pay the transfer cost once per row, no matter how many mutations you're applying, but whether that's performant enough depends would be case by case.
- josevalim 3y agomutate_with is still lazy and therefore you can't transform it. If you need to use transform, then you need to do: new_column = Series.transform(df["column"], fn arg -> ... end) DF.put(df, "column", new_column) which _is annoying_ since you are not supposed to use it. The correct way is to extend the Series API, which we will be very happy to!