[Numpy-discussion] fixing up datetime
Tue Jun 7 10:54:58 CDT 2011
On Tue, Jun 7, 2011 at 07:34, Dave Hirschfeld <email@example.com> wrote:
> I'm not convinced about the events concept - it seems to add complexity
> for something which could be accomplished better in other ways. A [Y]//4
> dtype is better specified as [3M] dtype, a [D]//100 is an [864S]. There
> may well be a good reason for it however I can't see the need for it in my
> own applications.
Well, [D/100] doesn't represent [864s]. It represents something that
happens 100 times a day, but not necessarily at precise regular
intervals. For example, suppose that I am representing payments that
happen twice a month, say on the 1st and 15th of every month, or the
5th and 20th. I would use [M/2] to represent that. It's not [2W], and
it's not [15D]. It's twice a month.
The default conversions may seem to imply that [D/100] is equivalent
to [864s], but they are not intended to. They are just a starting
point for one to write one's own, more specific conversions.
Similarly, we have default conversions from low frequencies to high
frequencies defaulting to representing the higher precision event at
the beginning of the low frequency interval. E.g. for days->seconds,
we assume that the day is representing the initial second at midnight
of that day. We then use offsets to allow the user to add more
information to specify it more precisely.
"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
More information about the NumPy-Discussion