[Numpy-discussion] datetime update

Travis Oliphant oliphant at enthought.com
Mon Nov 23 18:42:38 EST 2009


I've made a few changes to datetime today and spent some time looking  
over what is there and what remains to be implemented.

Basically, the biggest thing left to do is to implement the low-level  
casting functions to and from datetime types and other numpy types.   
In addition, the ufuncs need some auditing to make sure the right  
thing is being done when mixing different units.  After that, lots and  
lots of additional tests need to be written.      Once that is done,  
then most of the features should be available, but I suspect a few  
lingering issues might crop up and require fixing or fleshing out as  
well.

I was hoping that someone would be able to contribute more tests for  
datetime.    I will spend some time on the casting functions over the  
next few weeks and write a few tests.

I fixed a problem today with the fact that PyArray_DescrFromScalar was  
not returning a data-type object with the correct frequency  
information stored when given a datetime64 or timedelta64 scalar (it  
was ignoring the date-time metadata on the scalar).   This fixed a  
problem with the printing so that now a = arange(10).view('M8[Y]')  
shows something reasonable.

I also removed numpy.datetime and numpy.timedelta from the namespace  
(replaced them with numpy.datetime_ and numpy.timedelta_).   These  
were just short-hand for numpy.datetime64 and numpy.timedelta64  
respectively.   Avoiding the collision seemed like a good idea.

Right now, what works is "viewing" arrays as datetime data-types and  
getting and setting date-time arrays using datetime objects.   I would  
like to improve it so that setting with strings, integers, and other  
Python objects works as well.    Also, adding simple integers works, but

Dave C suggested removing the new C-API calls which sounds like a good  
idea to me for 1.4.0.   Which functions get exported into the C-API  
for 1.5.0 could then receive some discussion.

I apologize for the slow communication about where things are at.

Best regards,

-Travis





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091123/eb817bff/attachment.html>


More information about the NumPy-Discussion mailing list