-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Asobject tz #1383
Asobject tz #1383
Conversation
@@ -540,7 +540,9 @@ def asobject(self): | |||
|
|||
def _get_object_index(self): | |||
boxed_values = _dt_box_array(self.asi8, self.offset, self.tz) | |||
return Index(boxed_values, dtype=object) | |||
idx = Index(boxed_values, dtype=object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't actually what I meant in #1345, only to test that the Timestamp or datetime.datetime values in the resulting object arrays have the right tzinfo
set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that already in test_timezones.test_asobject_tz_box?
On Sun, Jun 3, 2012 at 1:17 PM, Wes McKinney <
reply@reply.github.com
wrote:
@@ -540,7 +540,9 @@ def asobject(self):
def _get_object_index(self): boxed_values = _dt_box_array(self.asi8, self.offset, self.tz)
return Index(boxed_values, dtype=object)
idx = Index(boxed_values, dtype=object)
This isn't actually what I meant in #1345, only to test that the Timestamp
or datetime.datetime values in the resulting object arrays have the right
tzinfo
set
Reply to this email directly or view it on GitHub:
https://github.com/pydata/pandas/pull/1383/files#r919922
Chang She
Lambda Foundry http://www.lambdafoundry.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, hmm. good point. asobject_tz_box
is actually not doing the right thing (and it disturbs me that the test passes). The issue is that there is a base time zone object that is obtained from pytz.timezone
and Timestamps actually receive one of its tzinfos:
In [4]: tz._tzinfos
Out[4]:
{(datetime.timedelta(-1, 68400),
datetime.timedelta(0),
'EST'): <DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>,
(datetime.timedelta(-1, 72000),
datetime.timedelta(0, 3600),
'EDT'): <DstTzInfo 'US/Eastern' EDT-1 day, 20:00:00 DST>,
(datetime.timedelta(-1, 72000),
datetime.timedelta(0, 3600),
'EPT'): <DstTzInfo 'US/Eastern' EPT-1 day, 20:00:00 DST>,
(datetime.timedelta(-1, 72000),
datetime.timedelta(0, 3600),
'EWT'): <DstTzInfo 'US/Eastern' EWT-1 day, 20:00:00 DST>}
In [5]: type(tz)
Out[5]: pytz.tzfile.US/Eastern
So the fact that that unit test passes is an accident. i'll remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further:
In [2]: rng
Out[2]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2010-02-13 00:00:00, ..., 2010-05-06 00:00:00]
Length: 83, Freq: D, Timezone: US/Eastern
In [3]: rng[0]
Out[3]: Timestamp(2010, 2, 13, 0, 0, tzinfo=<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>)
In [4]: rng[-1]
Out[4]: Timestamp(2010, 5, 6, 0, 0, tzinfo=<DstTzInfo 'US/Eastern' EDT-1 day, 20:00:00 DST>)
In [5]: rng[0].tz == rng[-1].tz
Out[5]: False
Cherry-picked the doc update and skipping the other commit. This is all set |
#1345