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: Respect input time zone if input is pandas Timestamp #18346

Merged
merged 1 commit into from
Aug 25, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

addresses part of #18127

pd.Timestamp subclasses datetime.datetime, but the current code checks type too tightly (elif input is datetime)

@MarcoGorelli MarcoGorelli changed the title feat: respect input time zone if input is pandas Timestamp feat: Respect input time zone if input is pandas Timestamp Aug 24, 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 and removed title needs formatting labels Aug 24, 2024
Comment on lines 81 to 82
elif input is datetime:
elif isinstance(input, type) and issubclass(input, datetime): # type: ignore[redundant-expr]
# pd.Timestamp subclasses `datetime.datetime`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy says the first check is redundant, although removing it makes some tests fail with

TypeError: issubclass() arg 1 must be a class

Copy link

codecov bot commented Aug 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.82%. Comparing base (dd1fc86) to head (1c4219d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18346      +/-   ##
==========================================
- Coverage   79.84%   79.82%   -0.02%     
==========================================
  Files        1496     1496              
  Lines      200333   200333              
  Branches     2841     2841              
==========================================
- Hits       159952   159916      -36     
- Misses      39856    39892      +36     
  Partials      525      525              

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

@ritchie46 ritchie46 merged commit 134c49f into pola-rs:main Aug 25, 2024
14 checks passed
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