Skip to content

BUG: datetime64 construction can underflow #8161

Open

Description

@chris-b1
In [9]: np.datetime64(np.iinfo(np.int64).min + 80000000000000, 'ns')
Out[9]: numpy.datetime64('2262-04-11T22:26:03.145224192')

In [11]: np.__version__
Out[11]: '1.11.1'

This is same issue as pandas-dev/pandas#14415 - pandas is using a modified vendored version of datetime.c

Potential fix here:
pandas-dev/pandas#14433

Assuming that's the right approach I can submit the same here.

Activity

  1. bashtage commented on Oct 21, 2016

    @bashtage
    Contributor

    I never understood this behavior either, although it is might be intentional given the 1970 reference date.

    >>> datetime64(np.iinfo(np.int64).max-1,'Y')
    numpy.datetime64('-9223372036854773840')
    
    >>> datetime64(np.iinfo(np.int64).max-1969,'Y')
    numpy.datetime64('NaT')
    
    >>> datetime64(np.iinfo(np.int64).max-1970,'Y')
    numpy.datetime64('9223372036854775807')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions