[Numpy-discussion] The date/time dtype and the casting issue

Pierre GM pgmdevlist@gmail....
Wed Jul 30 12:28:45 CDT 2008

On Wednesday 30 July 2008 13:16:25 Francesc Alted wrote:
> A Wednesday 30 July 2008, Pierre GM escrigué:
> >  It's just that I have trouble understanding the
> > meaning of something like
> >  t2 = numpy.ones(5, dtype="datetime64[s]")
> >
> > That's five times one second after the epoch, right ? But in what
> > circumstances would you need t2 ?
> I'm not sure I follow you.  This is just an example so as to produce an
> array of time objects quickly. 
> ...
> When you don't need the values for some 
> examples, conciseness is a virtue.

I'd prefer something like np.range(5, dtype=datetime64['s']), which is both 
concise and still has a physical meaning I can wrap my mind around.
Which brings me to another question:
datetime64 and timedelta64 are just dtypes, therefore they don't impose any 
restriction (in terms of uniqueness of elements, ordering of the elements...) 
on the underlying ndarray, right ?

More information about the Numpy-discussion mailing list