You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Timestamp constructor raises an exception when given iso8601 string with UTC offset and a desired timezone. When given datetime object with timezone and a desired timezone, it gives a correct string but incorrect internal timestamp value.
In [1]: frompandasimportTimestampasts, DataFrameasdfIn [2]: fromdatetimeimportdatetimeasdtIn [3]: frompytzimporttimezoneastzIn [4]: UTC='UTC'In [5]: EST='US/Eastern'In [6]: CST='US/Central'In [7]: # all the following should have the same timestamp valueIn [8]: # (commented lines throw exceptions!!)In [9]: tss=[ts("2012-01-02 01:00:00+00:00"),
...: # ts("2012-01-02 01:00:00+00:00", tz=EST),
...: ts("2012-01-01 20:00:00", tz=EST),
...: ts(dt(2012,1,1,20,0,0,tzinfo=tz(EST))),
...: ts(dt(2012,1,1,19,0,0,tzinfo=tz(CST))),
...: ts(dt(2012,1,1,20,0,0,tzinfo=tz(EST)), tz=EST),
...: ts(dt(2012,1,1,19,0,0,tzinfo=tz(CST)), tz=EST),
...: ts("2012-01-01 20:00:00-05:00"),
...: ts("2012-01-01 19:00:00-06:00"),
...: # ts("2012-01-01 20:00:00-05:00", tz=EST),
...: # ts("2012-01-01 19:00:00-06:00", tz=EST),
...: ts(1325466000000000000, tz=UTC),
...: ts(1325466000000000000, tz=EST)]
In [10]: strs= [str(ts) fortsintss]
In [11]: vals= [(ts.value/1000000000000) fortsintss]
In [12]: df({'strs' : strs, 'vals' : vals})
Out[12]:
strsvals02012-01-0201:00:00+00:00132546612012-01-0120:00:00-05:00132546622012-01-0120:00:00-05:00132546632012-01-0119:00:00-06:00132546642012-01-0120:00:00-05:001325448<--badvalue!!
52012-01-0120:00:00-05:001325448<--badvalue!!
62012-01-0120:00:00-05:00132546672012-01-0119:00:00-06:00132546682012-01-0201:00:00+00:00132546692012-01-0120:00:00-05:001325466
The text was updated successfully, but these errors were encountered:
Timestamp
constructor raises an exception when given iso8601 string with UTC offset and a desired timezone. When givendatetime
object with timezone and a desired timezone, it gives a correct string but incorrect internal timestamp value.The text was updated successfully, but these errors were encountered: