-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat(python): Deprecate with_column
#6128
Conversation
In rust it is very common to have similar named methods for different arguments. One takes an expression the other takes a sequence of expressions. I think we should leave it like that. |
afc3d5a
to
8525792
Compare
Ok, the failing tests were passing in a As a side note, I see that we handle things differently for args vs named_args in |
exprs = ( | ||
[] | ||
if exprs is None | ||
else ([exprs] if isinstance(exprs, pli.Expr) else list(exprs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my brain cant handle this on a Friday night...
@@ -5568,8 +5577,6 @@ def with_columns( | |||
└─────┴──────┴───────┴──────┴───────┘ | |||
|
|||
""" | |||
if exprs is not None and not isinstance(exprs, Sequence): | |||
exprs = [exprs] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now gone
Is everybody good to go on this one? I don't want to merge this immediately, but I want to add the deprecation on the breaking release I plan end of this month. This is core functionality IMO and I think we are becoming used enough that we should introduce a bit of a grace period. |
This will cause for many users deprecation warnings, so please double/triple check that we are happy with this indeed. |
Looks like a winner to me... One thing: I'd make the |
I think this is a good move! And we don't have to remove I agree with @alexander-beedie that we should include this version information in the deprecation message, to help users schedule their upgrade. Also, I am going to rebrand this as an 'enhancement', since this affects our public API. |
with_column
9621946
to
a05308a
Compare
Rebased & squashed. |
I had on purpose not added in a version, because we don't know (yet). I think, given that the warnings will be annoying, people would update relatively quickly their code after the Polars upgrade, but we will have to cater to users who update Polars infrequent. So I did not want to pin us down yet on a timeline. But if there is a good idea for how long it will be until 0.16 or 0.17 land, we can put that in. |
Fair enough. Maybe @ritchie46 can comment on this. Once we decide on what the deprecation message should be, this PR should be good to go! |
Just to be certain, we now accept
in |
Yes, that's correct! And also Series / list of Series. |
Alright. Thanks all! On the message. I think 0.17 or 0.18 seems a reasonable time duration? |
I'd say |
30ee907
to
30bddf8
Compare
Added 0.17 to docstring and the warning. |
30bddf8
to
ad0e0fe
Compare
ad0e0fe
to
e58febb
Compare
As `with_columns` has a superset of functionality. Remove test script Synchronize input arg parsing between DataFrame and LazyFrame with_columns Update py-polars/polars/internals/dataframe/frame.py Co-authored-by: Stijn de Gooijer <stijn@degooijer.io> Update py-polars/polars/internals/lazyframe/frame.py Co-authored-by: Stijn de Gooijer <stijn@degooijer.io> Update py-polars/polars/internals/dataframe/frame.py Co-authored-by: Stijn de Gooijer <stijn@degooijer.io> Update docstrings Fix doctests Revert Cargo.lock Specify v0.17 in deprecation warnings Fix faulty merge
e58febb
to
3a69b26
Compare
@ritchie46 is there still some doubt or unclarity about this change? If not, I think we should go ahead and merge this, as it's big and very prone to merge conflicts. |
Alright! Thanks all! |
Hadn't updated since 0.14.18, just installed 0.15.18, ran some code, saw the warning which made complete sense in both the warning displayed and the change it warned about, did a few search-and-replaces (I guess that's the plural) and no more warnings in less than five minutes. Just wanted to leave my two cents as an occasional user out in the field that this is an excellent example of how to deprecate old methods. Well done! |
Thanks! Always nice to hear some positive feedback 😸 |
See #6117. As you can see, this is a big change.
TODO's:
with_column
andwith_columns
is different forSeries
. I need to look into this.Probably later this week done.