[Numpy-discussion] Adding keyword to asarray and asanyarray.

Benjamin Root ben.root at ou.edu
Fri Mar 6 09:33:43 EST 2015


On Fri, Mar 6, 2015 at 7:59 AM, Charles R Harris <charlesr.harris at gmail.com>
wrote:

> Datetime64 seems to use the highest precision
>
> In [12]: result_type(ones(1, dtype='datetime64[D]'), 'datetime64[us]')
> Out[12]: dtype('<M8[us]')
>
> In [13]: result_type(ones(1, dtype='datetime64[D]'), 'datetime64[Y]')
> Out[13]: dtype('<M8[D]')
>


Ah, yes, that's what I'm looking for. +1 from me to have this in
asarray/asanyarray. Of course, there is always the usual caveats about
converting your datetime data in this manner, but this would be helpful in
many situations in writing functions that expect to deal with temporal data
at the resolution of minutes or somesuch.

Cheers!
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150306/df1a46ea/attachment.html>


More information about the NumPy-Discussion mailing list