Skip to content
Merged
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
11 changes: 7 additions & 4 deletions pandas/tests/series/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,17 @@ def test_2d_to_1d_assignment_raises():
x = np.random.randn(2, 2)
y = pd.Series(range(2))

msg = (
r"shape mismatch: value array of shape \(2,2\) could not be "
r"broadcast to indexing result of shape \(2,\)"
msg = "|".join(
[
r"shape mismatch: value array of shape \(2,2\) could not be "
r"broadcast to indexing result of shape \(2,\)",
r"cannot reshape array of size 4 into shape \(2,\)",
]
)
with pytest.raises(ValueError, match=msg):
y.loc[range(2)] = x

msg = r"could not broadcast input array from shape \(2,2\) into shape \(2\)"
msg = r"could not broadcast input array from shape \(2,2\) into shape \(2,?\)"
with pytest.raises(ValueError, match=msg):
y.loc[:] = x

Expand Down