Skip to content

Commit 4a7ac2e

Browse files
committed
fix: normalize Arrow-backed arrays to numpy in Ray test comparison
Ray 2.56.0 changed to return Arrow-backed DataFrames from Ray Data batches, so df[col].values returns ArrowExtensionArray instead of numpy ndarray. numpy.all() on bool[pyarrow] triggers a pandas/pyarrow incompatibility (axis kwarg not accepted). Use Series.to_numpy() to always get numpy arrays. Also revert the incorrect pandas<2.3 pin (wrong root cause diagnosis).
1 parent 90e8593 commit 4a7ac2e

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ classifiers = [
3030
]
3131
dependencies = [
3232
"numpy>=1.24",
33-
"pandas>=2.0,<2.3",
33+
"pandas>=2.0",
3434
"scipy>=1.10",
3535
"tabulate>=0.9",
3636
"scikit-learn>=1.3",

tests/integration_tests/test_ray.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,11 @@ def _to_hashable(v):
265265
df1 = df1.iloc[key1.argsort(kind="stable").values].reset_index(drop=True)
266266
df2 = df2.iloc[key2.argsort(kind="stable").values].reset_index(drop=True)
267267
for column in df1.columns:
268-
vals1 = df1[column].values
269-
vals2 = df2[column].values
268+
# Use to_numpy() rather than .values to ensure numpy arrays regardless of
269+
# backing store. Ray 2.56+ returns Arrow-backed DataFrames from Ray Data
270+
# batches, so .values may return ArrowExtensionArray instead of numpy.
271+
vals1 = df1[column].to_numpy()
272+
vals2 = df2[column].to_numpy()
270273

271274
if any(feature_name in column for feature_name in [CATEGORY]):
272275
is_equal = np.all(vals1 == vals2)

0 commit comments

Comments
 (0)