-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Open
Labels
API - ConsistencyInternal Consistency of API/BehaviorInternal Consistency of API/BehaviorNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Description
In [2]: In [1]: import pandas as pd
...: ...: import pyarrow as pa
...: ...:
...: ...: s = pd.Series([True, False, None])
...: ...: s + True
Out[2]:
0 2
1 1
2 NaN
dtype: object
In [3]: In [1]: import pandas as pd
...: ...: import pyarrow as pa
...: ...:
...: ...: s = pd.Series([True, False, None], dtype=pd.BooleanDtype())
...: ...: s + True
Out[3]:
0 True
1 True
2 <NA>
dtype: boolean
In [4]: In [1]: import pandas as pd
...: ...: import pyarrow as pa
...: ...:
...: ...: s = pd.Series([True, False, None], dtype=pd.ArrowDtype(pa.bool_()))
...: ...: s + True
...
File ~/pandas/core/arrays/arrow/array.py:1022, in ArrowExtensionArray._evaluate_op_method(self, other, op, arrow_funcs)
1020 result = pc_func(self._pa_array, other)
1021 except pa.ArrowNotImplementedError as err:
-> 1022 raise TypeError(self._op_method_error_message(other_original, op)) from err
1023 return self._from_pyarrow_array(result)
TypeError: operation 'add' not supported for dtype 'bool[pyarrow]' with object of type <class 'bool'>In addition to consistency, which result is preferred? I could see Out[2] or raising being the sensible behavior
Metadata
Metadata
Assignees
Labels
API - ConsistencyInternal Consistency of API/BehaviorInternal Consistency of API/BehaviorNA - MaskedArraysRelated to pd.NA and nullable extension arraysRelated to pd.NA and nullable extension arraysNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations