[Pandas-dev] tslibs 2.0 and non-nanosecond datetime64/timedelta64

Joris Van den Bossche jorisvandenbossche at gmail.com
Sat May 30 15:17:56 EDT 2020


Thanks for starting this discussion, Brock!

On Fri, 29 May 2020 at 21:03, Tom Augspurger <tom.augspurger88 at gmail.com>
wrote:

> On Fri, May 29, 2020 at 11:37 AM Brock Mendel <jbrockmendel at gmail.com>
> wrote:
>
>>
>> We could then consider de-duplication. Tick is already redundant with
>> Timedelta, and Timestamp[H] would render Period[H] redundant.  With
>> appropriate deprecation cycle, we could rip out a bunch of code.
>>
>
> What would the user facing changes that warrant deprecation? For me,
> `Period` represents a span of time. It would make sense to implement
> something like `pd.Timestamp("2000-01-01") in pd.Period("2000-01-01",
> freq="H")`. But something checking whether that timestamp is in a
> `Timestamp[H]` doesn't seem natural, since it represents a point in time
> rather than a span.
>
>
Personally, I don't think we necessarily need to add all units that are
supported by numpy's datetime64/timedelta64 dtypes. First, because I don't
think it is an important use case (people mostly want to be able to have
dates outside of the range limits that nanosecond resolution gives us), and
also because it makes it conceptually a lot more difficult. For example,
what is a "Timestamp[H]" value? Does it represent the beginning or the end
of the hour? That are questions that are already handled by the Period
dtype, and I think it is a good thing to keep those concepts separated (you
can of course ask the same question with a millisecond resolution, but I
think generally people don't do that).
Further, all the resolutions from nanosecond up to second are "just"
multiplications x1000, keeping the implementation more simple (compared to
resolutions of hours, months, ..).

So for a timestamp dtype, we could maybe only support ns / µs / ms / s
resolutions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pandas-dev/attachments/20200530/fd9cacc1/attachment.html>


More information about the Pandas-dev mailing list