[Numpy-discussion] fixing up datetime

Robert Kern robert.kern@gmail....
Thu Jun 2 14:57:37 CDT 2011


On Thu, Jun 2, 2011 at 13:44, Christopher Barker <Chris.Barker@noaa.gov> wrote:
> Pierre GM wrote:

>> Anyhow, years and months are simple enough.
>
> no, they are not -- they are fundamentally different than hours, days, etc.

That doesn't make them *difficult*. It's tricky to convert between
months and hours, yes, but that's not the only operation that we're
looking to represent. A *ton* of important time series are in these
calendrical units (monthly, semi-monthly, quarterly, yearly, etc.). If
you collect economic data on a monthly basis, you don't need to
unambiguously convert "January 2011" to a microsecond timestamp. You
do need to be able to "add 6 months", "add 1 year", and "roll up each
3 month period into quarters", etc. Each of those operations *is*
unambiguous. The data simply doesn't represent microsecond-sized
events.

The machinery to handle both is basically the same inside their areas
of applicability; you just have to disallow certain ambiguous
conversions between them, as Pierre suggests.

-- 
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


More information about the NumPy-Discussion mailing list