File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 15
15
16
16
def _indexOp (opname ):
17
17
"""
18
- Wrapper function for Series arithmetic operations, to avoid
18
+ Wrapper function for index comparison operations, to avoid
19
19
code duplication.
20
20
"""
21
21
def wrapper (self , other ):
22
22
func = getattr (self .view (np .ndarray ), opname )
23
- return func (other )
23
+ result = func (other )
24
+ try :
25
+ return result .view (np .ndarray )
26
+ except :
27
+ return result
24
28
return wrapper
25
29
26
30
Original file line number Diff line number Diff line change @@ -417,6 +417,16 @@ def test_isin(self):
417
417
self .assert_ (len (result ) == 0 )
418
418
self .assert_ (result .dtype == np .bool_ )
419
419
420
+ def test_boolean_cmp (self ):
421
+ values = [1 ,2 ,3 ,4 ]
422
+
423
+ idx = Index (values )
424
+ res = (idx == values )
425
+
426
+ self .assert_ ( res .all () )
427
+ self .assert_ ( res .dtype == 'bool' )
428
+ self .assert_ ( not isinstance (res , Index ) )
429
+
420
430
class TestInt64Index (unittest .TestCase ):
421
431
422
432
def setUp (self ):
You can’t perform that action at this time.
0 commit comments