Skip to content
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: non-nano strftime returns wrong results #50787

Closed
3 tasks done
Tracked by #46587
MarcoGorelli opened this issue Jan 17, 2023 · 1 comment · Fixed by #50793
Closed
3 tasks done
Tracked by #46587

BUG: non-nano strftime returns wrong results #50787

MarcoGorelli opened this issue Jan 17, 2023 · 1 comment · Fixed by #50793
Labels
Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Milestone

Comments

@MarcoGorelli
Copy link
Member

Pandas version checks

Reproducible Example

In [2]: DatetimeIndex(np.array(['-130000-01-01', '-130001-01-01'], dtype='datetime64[s]')).strftime('%Y')
Out[2]: Index(['1972', '1970'], dtype='object')

Issue Description

wrong dates :)

Expected Behavior

Index(['130000', '130001'], dtype='object')

Installed Versions

INSTALLED VERSIONS

commit : 9012a9f
python : 3.11.1.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.102.1-microsoft-standard-WSL2
Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 2.0.0.dev0+1209.g9012a9f49c
numpy : 1.25.0.dev0+363.gbb2769e12
pytz : 2022.7
dateutil : 2.8.2
setuptools : 65.7.0
pip : 22.3.1
Cython : 0.29.33
pytest : 7.2.0
hypothesis : 6.52.1
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.8.0
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : None
qtpy : None
pyqt5 : None
None

@MarcoGorelli MarcoGorelli added Bug Needs Triage Issue that has not been reviewed by a pandas team member Non-Nano datetime64/timedelta64 with non-nanosecond resolution and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 17, 2023
@MarcoGorelli MarcoGorelli added this to the 2.0 milestone Jan 17, 2023
@MarcoGorelli
Copy link
Member Author

simpler reproducer:

In [2]: Timestamp._from_value_and_reso(-4164570979200, 7, None).strftime('%Y')
Out[2]: '1972'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant