diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 3cb9cba01da48..d831e2e6a6dc5 100644 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1710,6 +1710,9 @@ def _setitem_with_indexer_split_path(self, indexer, value): self._setitem_single_column(loc, v, plane_indexer) else: + if isinstance(indexer[0], np.ndarray) and indexer[0].ndim > 2: + raise ValueError(r"Cannot set values with ndim > 2") + # scalar value for loc in ilocs: self._setitem_single_column(loc, value, plane_indexer) diff --git a/pandas/tests/indexing/test_indexing.py b/pandas/tests/indexing/test_indexing.py index 79834dc36ce7d..de70ff37a052a 100644 --- a/pandas/tests/indexing/test_indexing.py +++ b/pandas/tests/indexing/test_indexing.py @@ -139,7 +139,6 @@ def test_setitem_ndarray_3d(self, index, obj, idxr, idxr_id): with pytest.raises(err, match=msg): idxr[nd3] = 0 - @pytest.mark.xfail(reason="gh-32896") def test_setitem_ndarray_3d_does_not_fail_for_iloc_empty_dataframe(self): # when fixing this, please remove the pytest.skip in test_setitem_ndarray_3d i = Index([])