BUG: non-nano Timestamp methods return wrong results · Issue #53668 · pandas-dev/pandas (original) (raw)
Pandas version checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pandas.
- I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd print(pd.version)
ts = pd.Timestamp('-2000')
print(f'{ts.date()=}') print(f'{ts.isocalendar()=}') print(f'{ts.timetuple()=}') print(f'{ts.toordinal()=}')
ts.date()=datetime.date(1972, 1, 1) ts.isocalendar()=datetime.IsoCalendarDate(year=1971, week=52, weekday=6) ts.timetuple()=time.struct_time(tm_year=1972, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=1, tm_isdst=-1) ts.toordinal()=719893
Issue Description
Wrong dates
Expected Behavior
Should raise 'NotImplementedError'
As reference:
#50793
#53619 - fixed same bug for Timestamp.ctime (while working on docstrings).
Installed Versions
INSTALLED VERSIONS
commit : c65c8dd
python : 3.10.10.final.0
python-bits : 64
OS : Darwin
OS-release : 21.6.0
Version : Darwin Kernel Version 21.6.0: Mon Apr 24 21:10:53 PDT 2023; root:xnu-8020.240.18.701.5~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.UTF-8
pandas : 2.1.0.dev0+942.gc65c8ddd73.dirty
numpy : 1.24.3
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.8.0
pip : 23.1.2
Cython : 0.29.33
pytest : 7.3.1
hypothesis : 6.75.3
sphinx : 6.2.1
blosc : 1.11.1
feather : None
xlsxwriter : 3.1.1
lxml.etree : 4.9.2
html5lib : 1.1
pymysql : 1.0.3
psycopg2 : 2.9.6
jinja2 : 3.1.2
IPython : 8.13.2
pandas_datareader: None
bs4 : 4.12.2
bottleneck : 1.3.7
brotli :
fastparquet : 2023.4.0
fsspec : 2023.5.0
gcsfs : 2023.5.0
matplotlib : 3.7.1
numba : 0.57.0
numexpr : 2.8.4
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 12.0.0
pyreadstat : 1.2.1
pyxlsb : 1.0.10
s3fs : 2023.5.0
scipy : 1.10.1
snappy :
sqlalchemy : 2.0.15
tables : 3.8.0
tabulate : 0.9.0
xarray : 2023.5.0
xlrd : 2.0.1
zstandard : 0.21.0
tzdata : 2023.3
qtpy : None
pyqt5 : None