Skip to content

API: Series[bool with missing] + bool consistency#63064

@mroeschke

Description

@mroeschke
In [2]: In [1]: importpandasaspd ...: ...: importpyarrowaspa ...: ...: ...: ...: s=pd.Series([True, False, None]) ...: ...: s+TrueOut[2]: 02112NaNdtype: objectIn [3]: In [1]: importpandasaspd ...: ...: importpyarrowaspa ...: ...: ...: ...: s=pd.Series([True, False, None], dtype=pd.BooleanDtype()) ...: ...: s+TrueOut[3]: 0True1True2<NA>dtype: booleanIn [4]: In [1]: importpandasaspd ...: ...: importpyarrowaspa ...: ...: ...: ...: s=pd.Series([True, False, None], dtype=pd.ArrowDtype(pa.bool_())) ...: ...: s+True ... File~/pandas/core/arrays/arrow/array.py:1022, inArrowExtensionArray._evaluate_op_method(self, other, op, arrow_funcs) 1020result=pc_func(self._pa_array, other) 1021exceptpa.ArrowNotImplementedErroraserr: ->1022raiseTypeError(self._op_method_error_message(other_original, op)) fromerr1023returnself._from_pyarrow_array(result) TypeError: operation'add'notsupportedfordtype'bool[pyarrow]'withobjectoftype<class'bool'>

In addition to consistency, which result is preferred? I could see Out[2] or raising being the sensible behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    API - ConsistencyInternal Consistency of API/BehaviorNA - MaskedArraysRelated to pd.NA and nullable extension arraysNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions