Skip to content

BUG: Pandas 2.1.0 and Arrow 13: "Function 'divide' has no kernel matching input types" for durations #55020

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

Closed
2 of 3 tasks
bnavigator opened this issue Sep 5, 2023 · 1 comment · Fixed by #55048
Closed
2 of 3 tasks
Labels
Arrow pyarrow functionality Bug
Milestone

Comments

@bnavigator
Copy link
Contributor

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

pip install 'pyarrow>=13'
pip install 'pandas[test]==2.1.0'
pytest --pyargs pandas -k "TestBaseArithmeticOps and div and duration"

Issue Description

The Pandas 2.1.0 test suite tries to test a functionality of pyarrow which is only introduced in the upcoming v14, not in current v13. A quick incomplete glance at the GitHub Actions CI indicated to me that you test with pyarrow 9 and not yet stable arrow 14, but not with current pyarrow 13.0.0

=================================================================== test session starts ====================================================================
platform linux -- Python 3.11.4, pytest-7.4.1, pluggy-1.3.0
rootdir: /home/ben/tmp
plugins: xdist-3.3.1, asyncio-0.21.1, hypothesis-6.84.1
asyncio: mode=Mode.STRICT
collected 228801 items / 228721 deselected / 54 skipped / 80 selected                                                                                      

penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py ................................FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 93%]
FFFFF                                                                                                                                                [100%]

========================================================================= FAILURES =========================================================================
______________________________________ TestBaseArithmeticOps.test_arith_series_with_scalar[__floordiv__-duration[s]] _______________________________________

self = <pandas.tests.extension.test_arrow.TestBaseArithmeticOps object at 0x7f7fd2bea310>
data = <ArrowExtensionArray>
[   Timedelta('1 days 00:00:00'),    Timedelta('1 days 00:00:01'),
    Timedelta('1 days 00:00:0...      <NA>,
 Timedelta('-10 days +00:00:00'),   Timedelta('10 days 00:00:00')]
Length: 100, dtype: duration[s][pyarrow]
all_arithmetic_operators = '__floordiv__', request = <FixtureRequest for <Function test_arith_series_with_scalar[__floordiv__-duration[s]]>>

    def test_arith_series_with_scalar(self, data, all_arithmetic_operators, request):
        pa_dtype = data.dtype.pyarrow_dtype
    
        if all_arithmetic_operators == "__rmod__" and (
            pa.types.is_string(pa_dtype) or pa.types.is_binary(pa_dtype)
        ):
            pytest.skip("Skip testing Python string formatting")
    
        mark = self._get_arith_xfail_marker(all_arithmetic_operators, pa_dtype)
        if mark is not None:
            request.node.add_marker(mark)
    
>       super().test_arith_series_with_scalar(data, all_arithmetic_operators)

penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py:1075: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
penv/lib64/python3.11/site-packages/pandas/tests/extension/base/ops.py:133: in test_arith_series_with_scalar
    self.check_opname(ser, op_name, ser.iloc[0])
penv/lib64/python3.11/site-packages/pandas/tests/extension/base/ops.py:59: in check_opname
    self._check_op(ser, op, other, op_name, exc)
penv/lib64/python3.11/site-packages/pandas/tests/extension/base/ops.py:81: in _check_op
    result = op(ser, other)
penv/lib64/python3.11/site-packages/pandas/core/ops/common.py:76: in new_method
    return method(self, other)
penv/lib64/python3.11/site-packages/pandas/core/arraylike.py:218: in __floordiv__
    return self._arith_method(other, operator.floordiv)
penv/lib64/python3.11/site-packages/pandas/core/series.py:5820: in _arith_method
    return base.IndexOpsMixin._arith_method(self, other, op)
penv/lib64/python3.11/site-packages/pandas/core/base.py:1381: in _arith_method
    result = ops.arithmetic_op(lvalues, rvalues, op)
penv/lib64/python3.11/site-packages/pandas/core/ops/array_ops.py:275: in arithmetic_op
    res_values = op(left, right)
penv/lib64/python3.11/site-packages/pandas/core/ops/common.py:76: in new_method
    return method(self, other)
penv/lib64/python3.11/site-packages/pandas/core/arraylike.py:218: in __floordiv__
    return self._arith_method(other, operator.floordiv)
penv/lib64/python3.11/site-packages/pandas/core/arrays/arrow/array.py:684: in _arith_method
    return self._evaluate_op_method(other, op, ARROW_ARITHMETIC_FUNCS)
penv/lib64/python3.11/site-packages/pandas/core/arrays/arrow/array.py:672: in _evaluate_op_method
    result = pc_func(self._pa_array, other)
penv/lib64/python3.11/site-packages/pandas/core/arrays/arrow/array.py:130: in <lambda>
    "floordiv": lambda x, y: floordiv_compat(x, y),
penv/lib64/python3.11/site-packages/pandas/core/arrays/arrow/array.py:116: in floordiv_compat
    result = pc.floor(pc.divide(left, right))
penv/lib64/python3.11/site-packages/pyarrow/compute.py:245: in wrapper
    return func.call(args, None, memory_pool)
pyarrow/_compute.pyx:367: in pyarrow._compute.Function.call
    ???
pyarrow/error.pxi:144: in pyarrow.lib.pyarrow_internal_check_status
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])

pyarrow/error.pxi:121: ArrowNotImplementedError

[...]

================================================================= short test summary info ==================================================================
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__floordiv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__floordiv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__floordiv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__floordiv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rfloordiv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rfloordiv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rfloordiv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rfloordiv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__truediv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__truediv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__truediv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__truediv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rtruediv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rtruediv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rtruediv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_scalar[__rtruediv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__floordiv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__floordiv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__floordiv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__floordiv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rfloordiv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rfloordiv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rfloordiv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rfloordiv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__truediv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__truediv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__truediv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__truediv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rtruediv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rtruediv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rtruediv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_frame_with_scalar[__rtruediv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__floordiv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__floordiv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__floordiv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__floordiv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rfloordiv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rfloordiv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rfloordiv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rfloordiv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__truediv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__truediv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__truediv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__truediv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rtruediv__-duration[s]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[s], duration[s])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rtruediv__-duration[ms]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ms], duration[ms])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rtruediv__-duration[us]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[us], duration[us])
FAILED penv/lib64/python3.11/site-packages/pandas/tests/extension/test_arrow.py::TestBaseArithmeticOps::test_arith_series_with_array[__rtruediv__-duration[ns]] - pyarrow.lib.ArrowNotImplementedError: Function 'divide' has no kernel matching input types (duration[ns], duration[ns])
======================================= 48 failed, 32 passed, 54 skipped, 228721 deselected, 200 warnings in 49.01s ========================================

Arrow 12.0.0 is okay in this regard

Expected Behavior

Successful test suite / correct division of durations with pyarrow backend.

Installed Versions


commit : ba1cccd
python : 3.11.4.final.0
python-bits : 64
OS : Linux
OS-release : 6.4.11-1-default
Version : #1 SMP PREEMPT_DYNAMIC Thu Aug 17 04:57:43 UTC 2023 (2a5b3f6)
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : de_DE.UTF-8
LOCALE : de_DE.UTF-8

pandas : 2.1.0
numpy : 1.25.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 65.5.0
pip : 23.1.2
Cython : None
pytest : 7.4.1
hypothesis : 6.84.1
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader : None
bs4 : None
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 13.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None

@bnavigator bnavigator added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 5, 2023
@phofl phofl added this to the 2.1.1 milestone Sep 5, 2023
@phofl phofl added Arrow pyarrow functionality and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 5, 2023
@bnavigator
Copy link
Contributor Author

bnavigator commented Sep 7, 2023

#54327 assumes it got introduced in Arrow 13, but will only be in 14: apache/arrow#37192 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants