-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Timezone object of Timestamp vs DatetimeIndex is different for same time / timezone #17572
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
Comments
of course, these couldn't possibly be the same as in an index you have multiple tzs, while a timestamp has only 1. now sure what you are reporting here. |
And I don't understand what you are saying :-)
a DatetimeIndex has a single |
Small different example, where I create two equal DatetimeIndex instances in two different ways, and ending up with a different tz object:
I am not sure whether is an important issue. I just noticed it, and it seemed odd. |
tzobjects themselves don't often compare equal because they are tied to a specific datetime that is the localizer; but the strings do
this is just a fact of life w.r.t. timezone objects. you have entered the rabbit hole. I think this is a duplicate issue as well, pls have a look. |
I was confused about this as well at one point (comment), and this SO post echoes @jreback explanation about why the pytz tzobjects reps are different. While this should probably be explained better in the pytz docs, it might be worth adding a small clarification to the Pandas timeseries docs. |
Thanks for that link! Not sure whether this is worth adding a note about it to the pandas docs. |
I think this could be worth a small |
I'll take this quickie. Anything to make handling time smoother. I'm thinking something along the lines of mentioning |
closing in favor of #18595 which is the underlying reason/cause. |
Code Sample, a copy-pastable example if possible
When localizing a Timestamp vs timeseries/index, the timezones look similar
but under the hood the
tz
attributes of the DatetimeIndex is actually different as thetz
attribute of the actual Timestamps (even when accessing a single element of the DatetimeIndex as a Timestamp):The text was updated successfully, but these errors were encountered: