[Numpy-discussion] fixing up datetime

Mark Wiebe mwwiebe@gmail....
Wed Jun 8 19:53:09 CDT 2011


On Wed, Jun 8, 2011 at 4:57 AM, Wes McKinney <wesmckinn@gmail.com> wrote:

> <snip>
>
>
> So in summary, w.r.t. time series data and datetime, the only things I
> care about from a datetime / pandas point of view:
>
> - Ability to easily define custom timedeltas
>

Can you elaborate on this a bit? I'm guessing you're not referring to the
timedelta64 in NumPy, which is simply an integer with an associated unit.


> - Generate datetime objects, or some equivalent, which can be used to
> back pandas data structures
>

Do you mean mechanisms to generate sequences of datetime's? I'm fixing up
arange to work reasonably with datetimes at the moment.


> - (possible now??) Ability to have a set of frequency-naive dates
> (possibly not in order).
>

This should work just as well as if you have an arbitrary set of integers
specifying the locations of the sample points.

Cheers,
Mark

This last point actually matters. Suppose you wanted to get the worst
> 5-performing days in the S&P 500 index:
>
> In [7]: spx.index
> Out[7]:
> <class 'pandas.core.daterange.DateRange'>
> offset: <1 BusinessDay>, tzinfo: None
> [1999-12-31 00:00:00, ..., 2011-05-10 00:00:00]
> length: 2963
>
> # but this is OK
> In [8]: spx.order()[:5]
> Out[8]:
> 2008-10-15 00:00:00    -0.0903497960942
> 2008-12-01 00:00:00    -0.0892952780505
> 2008-09-29 00:00:00    -0.0878970494885
> 2008-10-09 00:00:00    -0.0761670761671
> 2008-11-20 00:00:00    -0.0671229140321
>
> - W
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110608/4e4ec28e/attachment.html 


More information about the NumPy-Discussion mailing list