[SciPy-Dev] tzinfo and scikits.timeseries

jamil egdemir unclejamil at gmail.com
Tue Apr 12 14:39:59 EDT 2011


Hi,

When using scikits.timeseries I'm running into an issue with timezone
information.  When using a datetime.datetime in the constructor for a
scikits.timeseries.Date, the tzinfo
is getting dropped.  Here's the output I'm getting when working from
inside ipython (on windows):

In [2]: import datetime

In [3]: from pytz import timezone

In [4]: eastern = timezone('US/Eastern')

In [5]: eastern
Out[5]: <DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>

In [6]: testing = eastern.localize(datetime.datetime(year = 2010,
month = 1, day = 1))

In [7]: testing
Out[7]: datetime.datetime(2010, 1, 1, 0, 0, tzinfo=<DstTzInfo
'US/Eastern' EST-1 day, 19:00:00 STD>)

In [8]: type(testing)
Out[8]: <type 'datetime.datetime'>

In [9]: import scikits.timeseries as TS

In [10]: aDate = TS.Date('D', datetime = testing)

In [11]: aDate
Out[11]: <D : 01-Jan-2010>

In [13]: after = aDate.datetime

In [14]: after
Out[14]: datetime.datetime(2010, 1, 1, 0, 0)

In [15]: after.tzinfo

In [16]: type(after.tzinfo)
Out[16]: <type 'NoneType'>

What's the best way to deal with this situation?  Is there a way to
keep hold of the tzinfo while still using scikits.timeseries.Date?

--
-j

-------------------------------------------------------------
Jamil Egdemir
unclejamil at gmail.com
AIM: unclejamil
YahooMessenger: uncle_jamil
http://grad.physics.sunysb.edu/~jamil
(631) 338-3170 (cell)
-------------------------------------------------------------



More information about the SciPy-Dev mailing list