Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def _cmp_method(self, other, op) -> ArrowExtensionArray:
pc_func = ARROW_CMP_FUNCS[op.__name__]
ltype = self._pa_array.type

if isinstance(other, (ExtensionArray, np.ndarray, list)):
if isinstance(other, (ExtensionArray, np.ndarray, list, range)):
try:
boxed = self._box_pa(other)
except pa.lib.ArrowInvalid:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/ops/invalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

def invalid_comparison(
left: ArrayLike,
right: ArrayLike | list | Scalar,
right: ArrayLike | list | range | Scalar,
op: Callable[[Any, Any], bool],
) -> npt.NDArray[np.bool_]:
"""
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3817,3 +3817,11 @@ def test_ufunc_retains_missing():

expected = pd.Series([np.sin(0.1), pd.NA], dtype="float64[pyarrow]")
tm.assert_series_equal(result, expected)


def test_comparison_with_range(data):
# GH#63429
ser = pd.Series(data)
result = ser == range(len(ser))
expected = np.array([False, False])
tm.assert_numpy_array_equal(result, expected)
Loading