File tree 1 file changed +12
-6
lines changed 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -522,17 +522,23 @@ def test_setitem_boolean(self):
522
522
values [values == 2 ] = 3
523
523
assert_almost_equal (df .values , values )
524
524
525
- with tm .assert_raises_regex (TypeError , 'Must pass '
526
- 'DataFrame with '
527
- 'boolean values only' ):
525
+ msg = "Must pass DataFrame or 2-d ndarray with boolean values only"
526
+ with tm .assert_raises_regex (TypeError , msg ):
528
527
df [df * 0 ] = 2
529
528
530
- # index with DataFrame
531
529
mask = df > np .abs (df )
532
530
expected = df .copy ()
533
- df [df > np .abs (df )] = nan
534
531
expected .values [mask .values ] = nan
535
- assert_frame_equal (df , expected )
532
+
533
+ # index with DataFrame
534
+ actual = df .copy ()
535
+ actual [mask ] = nan
536
+ assert_frame_equal (actual , expected )
537
+
538
+ # index with 2-d boolean ndarray
539
+ actual = df .copy ()
540
+ actual [mask .values ] = nan
541
+ assert_frame_equal (actual , expected )
536
542
537
543
# set from DataFrame
538
544
expected = df .copy ()
You can’t perform that action at this time.
0 commit comments