Skip to content

BUG: Inconsistency between Series[float].__rfloordiv__([timedelta]) and rfloordiv and further #63007

@cmp0xff

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

from datetime import timedelta import pandas as pd lis = [timedelta(seconds=1)] ser = pd.Series([1.0]) ser.rfloordiv(lis) # works, giving Series[Timedelta] # lis // ser # TypeError: unsupported operand type(s) for //: 'datetime.timedelta' and 'float' ser.rmod(lis) # works, giving Series[Timedelta] # lis % ser # TypeError: unsupported operand type(s) for %: 'datetime.timedelta' and 'float' # ser.rdivmod(lis) # AttributeError: 'tuple' object has no attribute '_name' # divmod(lis, ser) # TypeError: ufunc 'divmod' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Issue Description

The behavirours of

  • Series([float])__rfloordiv__([timedelta]) and rfloordiv
  • __rmod__ and rmod
  • __rdivmod__ and rdivmod

are different. This is found in pandas-dev/pandas-stubs#1452.

Expected Behavior

All should work. It is okay to get Series[object] as the result.

Installed Versions

INSTALLED VERSIONS

commit : f60bf95
python : 3.11.13
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.26100
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.0.dev0+2338.gf60bf958da.dirty
numpy : 2.2.6
dateutil : 2.9.0.post0
pip : 25.2
Cython : 3.1.3
sphinx : 8.2.3
IPython : 9.4.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.5
bottleneck : 1.5.0
fastparquet : 2024.11.0
fsspec : 2025.7.0
html5lib : 1.1
hypothesis : 6.138.3
gcsfs : 2025.7.0
jinja2 : 3.1.6
lxml.etree : 6.0.1
matplotlib : 3.10.5
numba : 0.61.2
numexpr : 2.10.2
odfpy : None
openpyxl : 3.1.5
psycopg2 : 2.9.10
pymysql : 1.4.6
pyarrow : 19.0.1
pyiceberg : 0.9.1
pyreadstat : 1.3.1
pytest : 8.4.1
python-calamine : None
pytz : 2025.2
pyxlsb : 1.0.10
s3fs : 2025.7.0
scipy : 1.16.1
sqlalchemy : 2.0.43
tables : 3.10.2
tabulate : 0.9.0
xarray : 2025.8.0
xlrd : 2.0.1
xlsxwriter : 3.2.5
zstandard : 0.23.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