Skip to content
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

depr: Deprecate dt.with_time_unit in favor of cast(pl.Int64).cast(pl.Datetime(time_unit, time_zone)) #13667

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

closes #13209

@github-actions github-actions bot added deprecation Add a deprecation warning to outdated functionality python Related to Python Polars rust Related to Rust Polars labels Jan 12, 2024
@MarcoGorelli MarcoGorelli force-pushed the depr-with-time-unit branch 2 times, most recently from 2d3f5a2 to 799ef4b Compare January 12, 2024 14:52
@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 12, 2024 15:31
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to cast to Int64 and then to the type we want? I would expect casting directly to work - we should implement that I think.

EDIT: I did not read the issue thoroughly enough. It makes sense to cast to Int64 first, otherwise it would be a cast_time_unit.

And I agree that we can drop this method as cast should take care of this.

py-polars/polars/expr/datetime.py Outdated Show resolved Hide resolved
@stinodego stinodego force-pushed the depr-with-time-unit branch from 288bc9b to c2c6d4a Compare January 15, 2024 11:36
@stinodego stinodego force-pushed the depr-with-time-unit branch from c2c6d4a to 26de758 Compare January 15, 2024 11:37
@stinodego stinodego removed the rust Related to Rust Polars label Jan 15, 2024
@stinodego stinodego changed the title depr: deprecate dt.with_time_unit, use cast(pl.Int64).cast(pl.Datetime(time_unit, time_zone)) depr: Deprecate dt.with_time_unit in favor of cast(pl.Int64).cast(pl.Datetime(time_unit, time_zone)) Jan 15, 2024
@stinodego stinodego merged commit b329389 into pola-rs:main Jan 15, 2024
12 checks passed
@github-actions github-actions bot added the rust Related to Rust Polars label Jan 15, 2024
@MarcoGorelli
Copy link
Collaborator Author

😄 no worries, it's very easy to confuse them, thanks for your review

r-brink pushed a commit to r-brink/polars that referenced this pull request Jan 15, 2024
…pl.Datetime(time_unit, time_zone))` (pola-rs#13667)

Co-authored-by: Stijn de Gooijer <stijndegooijer@gmail.com>
r-brink pushed a commit to r-brink/polars that referenced this pull request Jan 24, 2024
…pl.Datetime(time_unit, time_zone))` (pola-rs#13667)

Co-authored-by: Stijn de Gooijer <stijndegooijer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Add a deprecation warning to outdated functionality python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate dt.with_time_unit?
2 participants