Skip to content

BUG: pandas.Timestamp.view gives DeprecationWarning under numpy >= 2.5 #66608

Description

@cmp0xff

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
import numpy as np

td = pd.Timedelta(seconds=1)  # fine
# DeprecationWarning: The 'generic' unit for NumPy timedelta is deprecated, and will raise an error in the future. This includes implicit conversion of bare integers (e.g. `+ 1`).Please use a specific unit instead.
td.view(np.int64)

Issue Description

Calling view on pandas.Timedelta triggers a DeprecationWarning with numpy >= 2.5.

Expected Behavior

Free of DeprecationWarning

Installed Versions

Details

INSTALLED VERSIONS

commit : e68db09
python : 3.14.6
python-bits : 64
OS : Windows
OS-release : 11
Version : 10.0.26200
machine : AMD64
processor : AMD64 Family 25 Model 116 Stepping 1, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : Czech_Czechia.1252

pandas : 3.0.5
numpy : 2.5.1
dateutil : 2.9.0.post0
pip : 25.3
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.15.0
bottleneck : None
fastparquet : None
fsspec : 2026.7.0
html5lib : 1.1
hypothesis : None
gcsfs : None
jinja2 : 3.1.6
lxml.etree : 6.1.1
matplotlib : 3.11.1
numba : None
numexpr : 2.14.2
odfpy : None
openpyxl : 3.1.5
psycopg2 : None
pymysql : None
pyarrow : 25.0.0
pyiceberg : 0.11.1
pyreadstat : 1.3.5
pytest : 9.1.1
python-calamine : None
pytz : 2026.3.post1
pyxlsb : 1.0.10
s3fs : None
scipy : 1.18.0
sqlalchemy : 2.0.51
tables : 3.11.1
tabulate : 0.10.0
xarray : 2026.7.0
xlrd : 2.0.2
xlsxwriter : 3.2.9
zstandard : 0.25.0
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions