Description
Code Sample, a copy-pastable example if possible
import pandas as pd
g = pd.Period(year=2262, month=4, day=11, freq='D')
print(g.start_time)
g2 = pd.Period(year=2262, month=4, day=12, freq='D')
print(g2.start_time)
Output: (with pandas 0.25.0)
2262-04-11 00:00:00
1677-09-21 00:25:26.290448384
with pandas 0.25.0+216.g1aca08aa6
I get an OutOfBoundsDatetime error
print(g2.start_time)
Traceback (most recent call last):
File "", line 1, in
File "pandas/_libs/tslibs/period.pyx", line 1768, in pandas._libs.tslibs.period._Period.start_time.get
File "pandas/_libs/tslibs/period.pyx", line 1811, in pandas._libs.tslibs.period._Period.to_timestamp
File "pandas/_libs/tslibs/period.pyx", line 1190, in pandas._libs.tslibs.period.period_ordinal_to_dt64
File "pandas/_libs/tslibs/np_datetime.pyx", line 118, in pandas._libs.tslibs.np_datetime.check_dts_bounds
pandas._libs.tslibs.np_datetime.OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 2262-04-12 00:00:00
Problem description
Overflow means that the Period is incorrect, and also hinders use of Period for date/times outside the limits of pd.Timestamp
Expected Output
Output:
2262-04-11 00:00:00
2262-04-12 00:00:00
Output of pd.show_versions()
pandas : 0.25.0
numpy : 1.16.3
pytz : 2018.9
dateutil : 2.7.5
pip : 19.1.1
setuptools : 40.8.0
Cython : None
pytest : 4.2.0
hypothesis : None
sphinx : 2.1.2
blosc : None
feather : None
xlsxwriter : 1.1.2
lxml.etree : 4.3.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : None
pandas_datareader: None
bs4 : 4.7.1
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.3
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : 1.3.1
tables : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : 1.1.2