Skip to content

Force utc convertion in backend pandas to_datetime function #1955

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

schafsam
Copy link

Allow mixed timezone and shift them to utc while converting to datetime fixes #1309. The _to_datetime function seems to check for the timezone and adds it afterwards.

Adding the utc=True argument to the to_datetime function works with pandas and modin.pandas.to_datetime. I tried it and for pyspark.pandas but failed already with the import of the engine. Therefore, I assume pyspark might be secondary.

Allow mixed time zone and shift them to utc while converting to datetime.
Copy link

codecov bot commented Mar 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.58%. Comparing base (812b2a8) to head (14b5eeb).
Report is 209 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1955       +/-   ##
===========================================
- Coverage   94.28%   81.58%   -12.70%     
===========================================
  Files          91      121       +30     
  Lines        7013     9396     +2383     
===========================================
+ Hits         6612     7666     +1054     
- Misses        401     1730     +1329     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cosmicBboy
Copy link
Collaborator

Hi @schafsam, looks like the tests/core/test_pandas_engine.py::test_pandas_datetimetz_dtype is failing.

Adding the utc=True argument to the to_datetime function works with pandas and modin.pandas.to_datetime

Can't this be addressed by adding utc=True to the to_datetime_kwargs dict option?

@schafsam
Copy link
Author

schafsam commented Apr 1, 2025

Hi @cosmicBboy

That was the second thought to handle it with to_datetime_kwargs. I will give it a try, but need to figure out how or where it is set.

@cosmicBboy
Copy link
Collaborator

I will give it a try, but need to figure out how or where it is set.

If you provide a code snippet I can help out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling columns with multiple timezones
2 participants