Skip to content

COMPAT: Pyarrow supports div with duration #54327

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

Merged
merged 3 commits into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
pa_version_under8p0,
pa_version_under9p0,
pa_version_under11p0,
pa_version_under13p0,
)

from pandas.core.dtypes.dtypes import (
Expand Down Expand Up @@ -1005,7 +1006,14 @@ def _patch_combine(self, obj, other, op):

def _is_temporal_supported(self, opname, pa_dtype):
return not pa_version_under8p0 and (
opname in ("__add__", "__radd__")
(
opname in ("__add__", "__radd__")
or (
opname
in ("__truediv__", "__rtruediv__", "__floordiv__", "__rfloordiv__")
and not pa_version_under13p0
)
)
and pa.types.is_duration(pa_dtype)
or opname in ("__sub__", "__rsub__")
and pa.types.is_temporal(pa_dtype)
Expand Down Expand Up @@ -1054,7 +1062,14 @@ def _get_arith_xfail_marker(self, opname, pa_dtype):
f"for {pa_dtype}"
)
)
elif arrow_temporal_supported and pa.types.is_time(pa_dtype):
elif arrow_temporal_supported and (
pa.types.is_time(pa_dtype)
or (
opname
in ("__truediv__", "__rtruediv__", "__floordiv__", "__rfloordiv__")
and pa.types.is_duration(pa_dtype)
)
):
mark = pytest.mark.xfail(
raises=TypeError,
reason=(
Expand Down