Skip to content

Commit 4747c98

Browse files
committed
use different error to avoid recursion
1 parent 3604031 commit 4747c98

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/core/internals/blocks.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -992,15 +992,15 @@ def putmask(self, mask, new, align=True, inplace=False, axis=0,
992992
#
993993
# TODO: this prob needs some better checking
994994
# for 2D cases
995-
if ((is_list_like(new) and
996-
np.any(mask[mask]) and
995+
if ((is_list_like(new) and np.any(mask[mask]) and
997996
getattr(new, 'ndim', 1) == 1)):
998-
997+
# GH 19266 and GH 21977
999998
if not (mask.shape[-1] == len(new) or
1000999
mask[mask].shape[-1] == len(new) or
10011000
len(new) == 1):
1002-
raise ValueError("cannot assign mismatch "
1003-
"length to masked array")
1001+
raise NotImplementedError(
1002+
"Replace with array-like of mismatch length with mask "
1003+
"is not supported.")
10041004

10051005
np.putmask(new_values, mask, new)
10061006

0 commit comments

Comments
 (0)