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(rust, python): dont preserve sortedness in offset_by for tz-aware non-constant durations #9818

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

MarcoGorelli
Copy link
Collaborator

Example of the issue:

In [22]: ser = pl.date_range(datetime(2020, 10, 25), datetime(2020, 10, 25, 3), '30m', time_zone='Europe/London', eager=True)

In [23]: ser.dt.offset_by('1d')
Out[23]:
shape: (9,)
Series: 'date' [datetime[μs, Europe/London]]
[
        2020-10-26 00:00:00 GMT
        2020-10-26 00:30:00 GMT
        2020-10-26 01:00:00 GMT
        2020-10-26 01:30:00 GMT
        2020-10-26 01:00:00 GMT
        2020-10-26 01:30:00 GMT
        2020-10-26 02:00:00 GMT
        2020-10-26 02:30:00 GMT
        2020-10-26 03:00:00 GMT
]

In [24]: ser.dt.offset_by('1d').flags  # SORTED_ASC should not be set here
Out[24]: {'SORTED_ASC': True, 'SORTED_DESC': False}

@MarcoGorelli MarcoGorelli force-pushed the offset-by-sortedness branch from d8cb0ac to 0db74cc Compare July 11, 2023 18:39
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jul 11, 2023
@MarcoGorelli MarcoGorelli marked this pull request as ready for review July 11, 2023 18:54
@ritchie46 ritchie46 merged commit 9d2d689 into pola-rs:main Jul 12, 2023
c-peters pushed a commit to c-peters/polars that referenced this pull request Jul 14, 2023
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.

2 participants