Pandas version checks
Reproducible Example
import pandas as pd
pd.Timedelta(1.0, unit='days').round('100ms')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pandas/_libs/tslibs/timedeltas.pyx", line 2370, in pandas._libs.tslibs.timedeltas.Timedelta.round
File "pandas/_libs/tslibs/timedeltas.pyx", line 2331, in pandas._libs.tslibs.timedeltas.Timedelta._round
File "pandas/_libs/tslibs/fields.pyx", line 838, in pandas._libs.tslibs.fields.round_nsint64
File "pandas/_libs/tslibs/fields.pyx", line 795, in pandas._libs.tslibs.fields._round_nearest_int64
ZeroDivisionError: division by zero
Issue Description
Timedelta.round() raises ZeroDivisionError when the Timedelta's internal resolution is larger than the target rounding frequency. The same duration expressed in higher resolution rounds correctly.
The same code works in pandas 2.x and appears to be a regression in 3.x.
Expected Behavior
Rounding to a higher frequency than the internal resolution has a well-defined answer and should not raise an error:
pd.Timedelta(1.0, unit='days').round('100ms')
# Expected: Timedelta('1 days 00:00:00')
Installed Versions
Details
INSTALLED VERSIONS
commit : e04b26f
python : 3.12.12
python-bits : 64
OS : Linux
OS-release : 6.17.4-200.fc42.x86_64
Version : #1 SMP PREEMPT_DYNAMIC Sun Oct 19 18:47:49 UTC 2025
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 3.0.1
numpy : 2.4.3
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2026.2.0
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
psycopg2 : None
pymysql : None
pyarrow : 23.0.1
pyiceberg : None
pyreadstat : None
pytest : 9.0.2
python-calamine : None
pytz : 2026.1.post1
pyxlsb : None
s3fs : 2026.2.0
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : 2026.2.0
xlrd : None
xlsxwriter : None
zstandard : None
qtpy : None
pyqt5 : None
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
Issue Description
Timedelta.round()raisesZeroDivisionErrorwhen theTimedelta's internal resolution is larger than the target rounding frequency. The same duration expressed in higher resolution rounds correctly.The same code works in pandas 2.x and appears to be a regression in 3.x.
Expected Behavior
Rounding to a higher frequency than the internal resolution has a well-defined answer and should not raise an error:
Installed Versions
Details
INSTALLED VERSIONS
commit : e04b26f
python : 3.12.12
python-bits : 64
OS : Linux
OS-release : 6.17.4-200.fc42.x86_64
Version : #1 SMP PREEMPT_DYNAMIC Sun Oct 19 18:47:49 UTC 2025
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 3.0.1
numpy : 2.4.3
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : 2026.2.0
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
psycopg2 : None
pymysql : None
pyarrow : 23.0.1
pyiceberg : None
pyreadstat : None
pytest : 9.0.2
python-calamine : None
pytz : 2026.1.post1
pyxlsb : None
s3fs : 2026.2.0
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : 2026.2.0
xlrd : None
xlsxwriter : None
zstandard : None
qtpy : None
pyqt5 : None