File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,11 @@ def putmask_without_repeat(
81
81
# TODO: this prob needs some better checking for 2D cases
82
82
nlocs = mask .sum ()
83
83
if nlocs > 0 and is_list_like (new ) and getattr (new , "ndim" , 1 ) == 1 :
84
- if nlocs == len (new ):
84
+ shape = np .shape (new )
85
+ # np.shape compat for if setitem_datetimelike_compat
86
+ # changed arraylike to list e.g. test_where_dt64_2d
87
+
88
+ if nlocs == shape [- 1 ]:
85
89
# GH#30567
86
90
# If length of ``new`` is less than the length of ``values``,
87
91
# `np.putmask` would first repeat the ``new`` array and then
@@ -90,7 +94,7 @@ def putmask_without_repeat(
90
94
# to place in the masked locations of ``values``
91
95
np .place (values , mask , new )
92
96
# i.e. values[mask] = new
93
- elif mask .shape [- 1 ] == len ( new ) or len ( new ) == 1 :
97
+ elif mask .shape [- 1 ] == shape [ - 1 ] or shape [ - 1 ] == 1 :
94
98
np .putmask (values , mask , new )
95
99
else :
96
100
raise ValueError ("cannot assign mismatch length to masked array" )
You can’t perform that action at this time.
0 commit comments