You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ability to perform custom operations by using the map and apply functions
Feature demonstration with expected result
I would like to have the ability to perform a custom operation on a Series/Expr as such:
importplfrom'nodejs-polars';constdata=[{a: 'A',b: 10},{a: 'B',b: 20},{a: 'B',b: 13},{a: 'C',b: 40},];constmapping={D: 'OtherD'};constdf=pl.DataFrame(data);constdfWithOtherA=df.withColumns([pl.col("a").map((val)=>mapping[val]).alias('otherA')]);/* expected result: ┌─────┬──────┬────────┐ │ a ┆ b ┆ otherA │ │ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ str │ ╞═════╪══════╪════════╡ │ A ┆ 10.0 ┆ A │ ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ B ┆ 20.0 ┆ OtherB │ ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ B ┆ 13.0 ┆ OtherB │ ├╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┤ │ C ┆ 40.0 ┆ C │ └─────┴──────┴────────┘*/
The expected behavior should follow what is described in the polars docs.
Other comments
I would be happy to help with some guidance, but I still am not aware of polars internals to go for a PR.
Thank you for the awesome work in all other APIs and functions, keep the great work! :)
The text was updated successfully, but these errors were encountered:
so this is actually one of the more challenging ones to implement. It requires extensive knowledge of the n-api framework, as well as the rust polars internals. If anyone is up for a challenge, you can likely take a look at the python implementation to get a general idea of what they are doing.
Keep in mind, Pyo3 is a bit more flexible in what you can do than n-api is, so it will be a bit more challenging than the python implementation.
Ability to perform custom operations by using the map and apply functions
Feature demonstration with expected result
I would like to have the ability to perform a custom operation on a Series/Expr as such:
The expected behavior should follow what is described in the polars docs.
Other comments
I would be happy to help with some guidance, but I still am not aware of polars internals to go for a PR.
Thank you for the awesome work in all other APIs and functions, keep the great work! :)
The text was updated successfully, but these errors were encountered: