-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename all apply
functions to map_*
#10744
Comments
Series/Expr.apply -> map_elements 👍
|
Looks good; out of all of them, |
|
Yes, that is also because it is the hardest one to name. I can be any batch polars decides to give the function. Whereas That's why |
The way I see it, the current Methods are applied to the object they are called on. So if I call I mention I never liked the naming of
|
Yeah, I suppose technically you are mapping keys, perhaps It's a bit of an odd one as it can be defined in different ways, it's essentially an optimized/special-cased version of: But as you say (and the docstring), the emphasis could also be on the "replace" part instead of the "mapping".
|
This is not guaranteed. |
We can mention this with a note in the docstring / streaming docs, and it'll be fine I think. |
Ok! |
I always liked |
Just fueling the bikeshed, what about |
I would say |
Perhaps the default behavior should also be to use |
Right - I did not realize that was the default behavior 🤔 let's do a separate issue to discuss |
Done: #10755 |
@stinodego I meant |
I like this (I also dare to suggest |
I ended up going with |
@stinodego: The initial feature request suggested |
Closing in favor of #10755 as |
I'm just commenting here so this thread may potentially be indexed by Google for the following error messages as I spent 20 minutes too long figuring out why my code stopped working after re-installing Polars. The error messages I was getting was: As is clear in this thread apply is deprecated in Polars. Renaming apply to map_elements solved applying to a series. The highest ranking documentation in the SERP for the apply function was version v0.18 which naturally doesn't mention that it's deprecated. Hopefully this helps others out. |
In #10678, Ritchie mentions the reason for moving away from the
apply
naming:We will rename
Series/Expr.apply
tomap_elements
. Here's a list of other apply-related functions and proposed naming. Please use this topic to discuss the naming of these functions.apply
The following functions use
apply
and should be renamed:Series/Expr.apply
->map_elements
Series/Expr.rolling_apply
->rolling_map
DataFrame.apply
->map_rows
(Dynamic/Rolling)GroupBy.apply
->map_groups
pl.apply
->map_groups
map
The following functions use
map
and must be considered for a rename to avoid confusion:Series/Expr.map
->map_batches
DataFrame/LazyFrame.map
->map_batches
Series/Expr.map_dict
->replace
Series/Expr.map_alias
->name.map
The text was updated successfully, but these errors were encountered: