[SciPy-Dev] Baffled by type_check.datetime_data

David Goldsmith d.l.goldsmith at gmail.com
Wed Apr 28 13:11:20 EDT 2010


OK, I get it.

DG

On Wed, Apr 28, 2010 at 9:44 AM, Robert Kern <robert.kern at gmail.com> wrote:

> On Wed, Apr 28, 2010 at 11:41, David Goldsmith <d.l.goldsmith at gmail.com>
> wrote:
> > On Wed, Apr 28, 2010 at 8:57 AM, Robert Kern <robert.kern at gmail.com>
> wrote:
> >>
> >> On Tue, Apr 27, 2010 at 20:57, David Goldsmith <d.l.goldsmith at gmail.com
> >
> >> wrote:
> >> >>>> np.version.version
> >> > '1.4.0'
> >> >>>> from numpy.lib.type_check import datetime_data as dtd
> >> >>>> help(dtd)
> >> > Help on function datetime_data in module numpy.lib.type_check:
> >> >
> >> > datetime_data(dtype)
> >> >     Return (unit, numerator, denominator, events) from a datetime
> dtype
> >> >
> >> >>>> np.dtype(np.datetime_)
> >> > dtype('datetime64[us]')
> >> >>>> dtd(np.datetime_)
> >>
> >> datatime_data() takes a dtype, not a scalar type.
> >>
> >> --
> >> Robert Kern
> >
> > How is np.datetime_ not a dtype, and how is
> >
> >>>> np.dtype(np.datetime_)
> > dtype('datetime64[us]')
> >
> > _not_ an indication that it isn't a dtype?
>
> How *is* it an indication that it is a dtype? The scalar types can be
> coerced to dtypes, but they are not dtype objects themselves, just
> like strings like '>i4' are str objects, not dtype objects but they
> can be coerced to dtype objects.
>
> > How do I create a dtype object
> > that datetime_data will recognize?
>
> You just did it!
>
> np.dtype(np.datetime_)
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>  -- Umberto Eco
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>



-- 
Mathematician: noun, someone who disavows certainty when their uncertainty
set is non-empty, even if that set has measure zero.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20100428/f42dca68/attachment.html>


More information about the SciPy-Dev mailing list