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: Convert to given time zone in .str.to_datetime when values are offset-aware #16742

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Jun 5, 2024

related to #16297

This only deals with the .str.to_datetime part, and makes the behaviour match the constructor behaviour in https://github.com/pola-rs/polars/pull/16828/files for offset-aware input and non-missing time_zone:

In [4]: pl.Series(['1970-01-01T00:00:00+03:30']).str.to_datetime(time_zone='Iran')
Out[4]: 
shape: (1,)
Series: '' [datetime[μs, Iran]]
[
        1970-01-01 00:00:00 +0330
]

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.38%. Comparing base (c81ef69) to head (dc75b4c).
Report is 17 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16742   +/-   ##
=======================================
  Coverage   81.38%   81.38%           
=======================================
  Files        1425     1425           
  Lines      187606   187662   +56     
  Branches     2697     2702    +5     
=======================================
+ Hits       152677   152732   +55     
  Misses      34434    34434           
- Partials      495      496    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented Jun 5, 2024

CodSpeed Performance Report

Merging #16742 will degrade performances by 16.38%

Comparing MarcoGorelli:convert-to-tz (dc75b4c) with main (eaedf74)

Summary

❌ 1 regressions
✅ 36 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main MarcoGorelli:convert-to-tz Change
test_groupby_h2oai_q3 2.4 ms 2.9 ms -16.38%

@MarcoGorelli MarcoGorelli changed the title wip feat: convert to give time zone in Series constructor for tz-aware data feat: convert to give time zone in Series constructor for tz-aware data Jun 8, 2024
@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Jun 8, 2024
@MarcoGorelli MarcoGorelli force-pushed the convert-to-tz branch 2 times, most recently from 2753551 to e35a344 Compare June 8, 2024 10:03
@MarcoGorelli MarcoGorelli marked this pull request as ready for review June 8, 2024 10:08
@MarcoGorelli MarcoGorelli marked this pull request as draft June 8, 2024 18:28
@MarcoGorelli MarcoGorelli changed the title feat: convert to give time zone in Series constructor for tz-aware data feat: convert to give time zone in .dt.to_datetime when values are offset-aware Jun 9, 2024
@MarcoGorelli MarcoGorelli changed the title feat: convert to give time zone in .dt.to_datetime when values are offset-aware feat: convert to give time zone in .str.to_datetime when values are offset-aware Jun 9, 2024
@MarcoGorelli MarcoGorelli force-pushed the convert-to-tz branch 3 times, most recently from 0af0cdd to 5a400da Compare June 9, 2024 13:16
@MarcoGorelli MarcoGorelli marked this pull request as ready for review June 9, 2024 13:26
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.

Looks good, thanks! Left a very minor nitpick but is good to merge imo.

Thanks for picking this up.

@MarcoGorelli
Copy link
Collaborator Author

thanks @stinodego ! cool, merging then

@MarcoGorelli MarcoGorelli merged commit c9cad0a into pola-rs:main Jun 10, 2024
27 checks passed
@stinodego stinodego changed the title feat: convert to give time zone in .str.to_datetime when values are offset-aware feat: Convert to given time zone in .str.to_datetime when values are offset-aware Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants