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

fix: Forbid casting from Date to Time and vice versa #14127

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jan 31, 2024

Closes #14124

Changes

  • Casting from Date to Time now raises instead of producing 00:00:00 for every value.
  • Casting from Time to Date now raises instead of using the underlying physical representation.

This should probably be considered a breaking change, at least the Date->Time part. The other way around was nonsense, e.g.:

from datetime import time

import polars as pl

s = pl.Series([time(0, 0)])
result = s.cast(pl.Date)
print(result)
shape: (1,)
Series: '' [date]
[
        1970-01-01
]

@github-actions github-actions bot added breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Jan 31, 2024
@stinodego stinodego marked this pull request as ready for review January 31, 2024 10:50
@ritchie46 ritchie46 merged commit ba0a5a8 into main Jan 31, 2024
25 checks passed
@ritchie46 ritchie46 deleted the date-time-cast branch January 31, 2024 11:32
@stinodego stinodego removed the breaking Change that breaks backwards compatibility label Jan 31, 2024
@stinodego stinodego changed the title feat!: Forbid casting from Date to Time and vice versa fix: Forbid casting from Date to Time and vice versa Jan 31, 2024
@stinodego stinodego removed the enhancement New feature or an improvement of an existing feature label Jan 31, 2024
@github-actions github-actions bot added the fix Bug fix label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Casting from Date to Time should raise
2 participants