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

BUG: Timezone upon DatetimeIndex union is changed to UTC #60080

Open
2 of 3 tasks
alippai opened this issue Oct 21, 2024 · 2 comments · May be fixed by #61234
Open
2 of 3 tasks

BUG: Timezone upon DatetimeIndex union is changed to UTC #60080

alippai opened this issue Oct 21, 2024 · 2 comments · May be fixed by #61234
Assignees
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Timezones Timezone data dtype

Comments

@alippai
Copy link
Contributor

alippai commented Oct 21, 2024

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

i1 = pd.DatetimeIndex(['2020-01-01 10:00:00+05:00']).astype('datetime64[us, UTC+05:00]')
i2 = pd.DatetimeIndex(['2020-01-01 10:00:00+05:00']).astype('datetime64[ns, UTC+05:00]')
i1.union(i2) # returns DatetimeIndex(['2020-01-01 05:00:00+00:00'], dtype='datetime64[ns, UTC]', freq=None)

Issue Description

@lukemanley @mroeschke looks like test case from #55238 could be extended to different timezones, currently if taking the union of two DatetimeIndex with the same timezone, but different unit, then it results in an UTC timezone.

Expected Behavior

The result should be the higher resolution unit and the original timezone

Installed Versions

python : 3.10.14 pandas : 2.2.2
@alippai alippai added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 21, 2024
@rhshadrach rhshadrach added Timezones Timezone data dtype Dtype Conversions Unexpected or buggy dtype conversions and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 2, 2024
@brandonmonge
Copy link

take

@myenugula
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Timezones Timezone data dtype
Projects
None yet
4 participants