-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add casts and string to datetime conversion #27
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
disallow string to bool casts
we always truncate, like in C
polars does not write them properly to the database
we do not guarantte equivalence here (e.g. 0.0 vs 0), but we guarantee that a sequence of casts Float64 -> String -> Float64 is the identity (up to some epsilon).
so that e.g. mssql can return DATETIME2 instead of DATETIME
we currently only guarantee this to work for datetimes of the form YYYY-MM-DD HH:MM:SS.MILLIS (yes, exactly six digits after the comma, which makes sense since we guarantee all operations on datetimes on millisecond precision)
we allow __eq__ between a dtype instance and a dtype class. When comparing with a class, const and vararg are ignored.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have casts for the following pairs of types now:
We do not consider string to datetime conversion a cast (polars also does not do this), but have
.str.to_datetime()
and.str.to_date()
methods instead. These will support a format parameter in the future. Currently they acceptYY-MM-DD HH:MM:SS:MILLIS
only. For float to string, we only guarantee equivalence up to trailing zeros. Float to int conversion throws on inf / nan, except for Sqlite (it does not throw on itself, and transform cannot do this).