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

tz_convert sometimes returns results different from Pandas (but same as zoneinfo) #13380

Open
shwina opened this issue May 18, 2023 · 1 comment

Comments

@shwina
Copy link
Contributor

shwina commented May 18, 2023

tz_convert returns a result different from Pandas for this pre-1900 example:

>>> pd.Series(["1899-01-01 12:00"], dtype="datetime64[s]").dt.tz_localize("Europe/Paris").dt.tz_convert("America/New_York")
0   1899-01-01 06:55:00-04:56
dtype: datetime64[ns, America/New_York]

>>> cudf.Series(["1899-01-01 12:00"], dtype="datetime64[s]").dt.tz_localize("Europe/Paris").dt.tz_convert("America/New_York")
0   1899-01-01 06:50:39-04:56
dtype: datetime64[s, America/New_York]

However, our result is the same as you would get with zoneinfo:

>>> datetime(1899, 1, 1, 12, 0, tzinfo=ZoneInfo("Europe/Paris")).astimezone(ZoneInfo("America/New_York"))
datetime.datetime(1899, 1, 1, 6, 50, 39, tzinfo=zoneinfo.ZoneInfo(key='America/New_York'))

@mroeschke I'm curious if this aligns with your experience with the difference between Pandas (pytz) and zoneinfo?

Originally posted by @shwina in #13328 (comment)

@shwina shwina added the python label May 18, 2023
@mroeschke
Copy link
Contributor

mroeschke commented May 18, 2023

Yeah I've encountered pytz having different UTC offsets than other libraries in some of these edge cases.

FWIW pandas will default to zoneinfo in 3.0 so this will align with cudf in the future

@vyasr vyasr removed the python label Feb 23, 2024
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

No branches or pull requests

3 participants