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

feat!: Change str.to_datetime to default to microsecond precision for format specifiers "%f" and "%.f" #13597

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Jan 10, 2024

Closes #13592

Changes

  • In .str.to_datetime, when specifying %.f as the format, the default was to set the resulting datatype to nanosecond precision. This will now be changed to microsecond precision.

Example

Before

>>> s = pl.Series(["2022-08-31 00:00:00.123456789"])
>>> s.str.to_datetime(format="%Y-%m-%d %H:%M:%S%.f")
shape: (1,)
Series: '' [datetime[ns]]
[
        2022-08-31 00:00:00.123456789
]

After

>>> s.str.to_datetime(format="%Y-%m-%d %H:%M:%S%.f")
shape: (1,)
Series: '' [datetime[us]]
[
        2022-08-31 00:00:00.123456
]

@github-actions github-actions bot added breaking Change that breaks backwards compatibility fix Bug fix python Related to Python Polars labels Jan 10, 2024
@MarcoGorelli MarcoGorelli added the do not merge This pull requests should not be merged right now label Jan 10, 2024
@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 10, 2024 13:57
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.

Seems like a good idea 👍

@stinodego stinodego added this to the 1.0.0 milestone Jan 10, 2024
@stinodego stinodego changed the title fix(python)!: default to microsecond time_unit in to_datetime for "%f" and "%.f" feat(python)!: default to microsecond time_unit in to_datetime for "%f" and "%.f" Jan 10, 2024
@stinodego stinodego removed the fix Bug fix label Jan 10, 2024
@github-actions github-actions bot added the enhancement New feature or an improvement of an existing feature label Jan 10, 2024
@stinodego stinodego changed the title feat(python)!: default to microsecond time_unit in to_datetime for "%f" and "%.f" feat!: default to microsecond time_unit in to_datetime for "%f" and "%.f" Jan 30, 2024
@github-actions github-actions bot added the rust Related to Rust Polars label Jan 30, 2024
@stinodego stinodego changed the title feat!: default to microsecond time_unit in to_datetime for "%f" and "%.f" feat!: Default to microsecond time_unit in to_datetime for "%f" and "%.f" Jan 30, 2024
@stinodego stinodego changed the title feat!: Default to microsecond time_unit in to_datetime for "%f" and "%.f" feat!: Change .str.to_datetime to default to microsecond precision for format specifiers "%f" and "%.f" May 23, 2024
@stinodego stinodego removed this from the 1.0.0 milestone May 23, 2024
@stinodego stinodego force-pushed the default-to-microseconds-more branch from 67e964d to ac09e46 Compare June 4, 2024 08:08
@stinodego stinodego requested a review from reswqa as a code owner June 4, 2024 08:08
@stinodego stinodego merged commit 62a1577 into pola-rs:main Jun 4, 2024
25 checks passed
@stinodego stinodego changed the title feat!: Change .str.to_datetime to default to microsecond precision for format specifiers "%f" and "%.f" feat!: Change str.to_datetime to default to microsecond precision for format specifiers "%f" and "%.f" Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Change that breaks backwards compatibility do not merge This pull requests should not be merged right now enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change .str.to_datetime to default to microsecond precision for format specifiers "%f" and "%.f"
2 participants