[Numpy-discussion] fixing up datetime

Mark Wiebe mwwiebe at gmail.com
Wed Jun 1 17:27:12 EDT 2011


On Wed, Jun 1, 2011 at 4:01 PM, Ralf Gommers <ralf.gommers at googlemail.com>wrote:

>
>
> On Wed, Jun 1, 2011 at 10:05 PM, Mark Wiebe <mwwiebe at gmail.com> wrote:
>
>> Hey all,
>>
>> So I'm doing a summer internship at Enthought, and the first thing they
>> asked me to look into is finishing the datetime type in numpy. It turns out
>> that the estimates of how complete the type was weren't accurate, and to
>> support what the NEP describes required generalizing the ufunc type
>> resolution system. I also found that the date/time parsing code (based on
>> mxDateTime) was not robust, producing something for almost any arbitrary
>> garbage input. I've replaced much of the broken code and implemented a lot
>> of the functionality, and thought this might be a good point to do a pull
>> request on what I've got and get feedback on the issues I've run into.
>>
>> * The existing datetime-related API is probably not useful, and in fact
>> those functions aren't used internally anymore. Is it reasonable to remove
>> the functions, or do we just deprecate them?
>>
>
> If the existing API is really not useful (which requires some
> discussion/review I guess) then I think it would be good to announce that on
> the mailing list and throw it out ASAP. The API can't have many users yet,
> since it has only just been released (again), so the sooner it's gone the
> better. I know normal policy would be to deprecate first, but I don't really
> see the point.
>

Here's a quick rundown:

PyArray_SetDatetimeParseFunction:

The NEP indicated ISO 8601 format for input, and I think a function which
converts arbitrary input into ISO 8601 format is better than setting a
function inside NumPy itself. In my current branch, this function does
nothing.


PyArray_DatetimeToDatetimeStruct, and the 3 other similar ones:

These functions only take the base unit for conversion, not the full
metadata. To properly do the conversions, you also need the multiplier and
the number of events, and if the extended business day idea I described is
implemented, that workday/holiday data. I've made equivalent internal
functions that take the metadata as the parameter instead, but I'm hesitant
to expose public API until things are baked a bit more.


And after the removal of datetime from 1.4.1 and now this, I'd be in favor
> of putting a large "experimental" sticker over the whole thing until further
> notice.
>
+1

-Mark

>
> Ralf
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110601/f219df64/attachment.html>


More information about the NumPy-Discussion mailing list