[Numpy-discussion] fixing up datetime

Mark Wiebe mwwiebe@gmail....
Fri Jun 10 18:18:16 CDT 2011


On Thu, Jun 9, 2011 at 3:17 PM, Wes McKinney <wesmckinn@gmail.com> wrote:

> On Wed, Jun 8, 2011 at 8:53 PM, Mark Wiebe <mwwiebe@gmail.com> wrote:
> > 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.
>
> I guess what I am thinking of may not need to be available at the
> NumPy level. As an example, suppose you connected a timedelta
> (DateOffset, in pandas parlance) to a set of holidays, so when you
> say:
>
> date + BusinessDay(1, calendar='US')
>

If you have a moment of time, can you comment on the business day api I
proposed, and possibly try out the busday_offset function I've begun? It
doesn't do holidays yet, but the weekmask seems to work.

-Mark


>
> then you have some custom logic which knows how to describe the result
> of that. Some things along these lines have already been discussed--
> but this is the basic way that the date offsets work in pandas, i.e.
> subclasses of DateOffset which implement custom logic. Probably too
> high level for NumPy.
>
> >>
> >> - 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.
>
> Yes, that will be very nice.
>
> >>
> >> - (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
>
> Cool (!).
>
> >>
> >> 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
> >
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> _______________________________________________
> 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/20110610/dcc71a92/attachment-0001.html 


More information about the NumPy-Discussion mailing list