[Numpy-discussion] RFC: A proposal for implementing some date/time types in NumPy

Francesc Alted faltet at pytables.org
Mon Jul 14 12:09:51 EDT 2008


A Monday 14 July 2008, David Huard escrigué:
> 2008/7/14 Francesc Alted <faltet at pytables.org>:
> > [...]
> >
> > > DateArray([14-Jan-2001 14:34:33, 16-Jan-2001 10:09:11],
> > >           freq='S')
> >
> > That's great.  However we only planned to import/export dates from
> > the ``datetime`` module for the time being, mainly because of
> > efficency but also simplicity.  Would many people be interested in
> > seeing this kind of string date parsing integrated in the native
> > NumPy types?
>
> It's useful to have a complete string representation to write dates
> to a file and be able to retrieve them later on. In this sense, a
> strftime-like
> write/read method would be appreciated (where the date format is
> specified by the user or set by convention).
>
> On the other hand, trying to second guess the format the date is
> formatted in can quickly turn
> into a regular expression nightmare (look at the mx.datetime module
> that does this). I'd hate
> to see you waste time on this.

Ok.  With the proposal based on the 'resolution' concept we were going 
to output the times in string format (more specifically, the ISO 8601 
format so as to follow a clear standard).  My guess is that adding code 
to parse this specific format on input should be easy and is a 
reasonable thing to do.

I agree that adding parsers for more formats would innecessarily 
complicate things.

Thanks,

-- 
Francesc Alted



More information about the NumPy-Discussion mailing list