You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
importnumpyasnpimportpandasaspdimportpyarrowaspaseries=pd.Series([1.0, 2.0, 3.0], dtype=pd.ArrowDtype(pa.float64()))
series/np.array([2.0])
# ArrowInvalid: Array arguments must all be the same length
Issue Description
When performing arithmetic operations between a Series of ArrowDtype and a single-value array, the array is not broadcasted to match the series shape. Instead, it raises an ArrowInvalid error. This behavior is inconsistent, as the same operation works correctly with both default and numpy-nullable dtypes.
A solution could be casting a single-element array to a pa.Scalar in ArrowExtensionArray._evaluate_op_method:
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
Issue Description
When performing arithmetic operations between a
Series
ofArrowDtype
and a single-value array, the array is not broadcasted to match the series shape. Instead, it raises anArrowInvalid error
. This behavior is inconsistent, as the same operation works correctly with both default and numpy-nullable dtypes.A solution could be casting a single-element array to a
pa.Scalar
inArrowExtensionArray._evaluate_op_method
:pandas/pandas/core/arrays/arrow/array.py
Line 755 in 2a10e04
Expected Behavior
The code doesn't fail, and behavior to be consistent over different dtype back-ends
Installed Versions
Pandas v2.2.3:
Nightly Pandas:
The text was updated successfully, but these errors were encountered: