-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Out of bounds Timestamp does not raise exception #19382
Comments
Has anybody seen an instance where a test will not raise an exception, but the same line in the Python interpreter does? |
There's a reason (arguable whether it's a good one) for the difference between the Your upper string example definitely looks buggy - PR would be welcome! >>> Timestamp('2262-04-11 23:47:16.854775808')
Timestamp('2262-04-11 23:47:16.854775') |
So should we normalize it so that any format generates an |
Yeah, I tend to think it'd be better if all of these raised an |
There is another variation for DatetimeIndex. In [3]: pd.DatetimeIndex(np.array(['2262-04-11 23:47:16.854775808'], dtype='datetime64'))
Out[3]: DatetimeIndex(['NaT'], dtype='datetime64[ns]', freq=None) So it's not exactly silent, but does differ from what happens for a Timestamp, which is the bug that we're talking about there. But suppose we address the upper bound for the Timestamp and make it, say, raise Can't an argument be made for returning |
An
OutOfBoundsDatetime
exception is raised if a datetime that goes beyond the minimum datetime is specified in both nanoseconds:and as a string:
An
OverflowError
is raised if going beyond the maximum datetime when instantiating with the number nanoseconds:but an incorrect Timestamp is returned if an out-of-bounds datetime string is specified:
Verified that this is the case for
DatetimeIndex
as well.Expected Output
OutOfBoundsDatetime
exception is raisedOutput of
pd.show_versions()
python: 3.6.2.final.0
python-bits: 64
OS: Darwin
OS-release: 16.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.0.dev0+169.gb38dc4105
pytest: 3.3.1
pip: 9.0.1
setuptools: 28.8.0
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: 0.7.1
xarray: 0.10.0
IPython: 6.2.1
sphinx: 1.6.5
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: 1.5.1
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: 0.4.0
matplotlib: 2.1.1
openpyxl: 2.4.9
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.1.15
pymysql: 0.7.11.None
psycopg2: None
jinja2: 2.10
s3fs: 0.1.2
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: