File tree 2 files changed +5
-8
lines changed
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -116,17 +116,11 @@ def cmp_method(self, other):
116
116
with np .errstate (all = "ignore" ):
117
117
result = op (self .values , np .asarray (other ))
118
118
119
- # technically we could support bool dtyped Index
120
- # for now just return the indexing array directly
121
119
if is_bool_dtype (result ):
122
120
return result
123
- try :
124
- return Index (result )
125
- except TypeError :
126
- return result
121
+ return ops .invalid_comparison (self , other , op )
127
122
128
123
name = "__{name}__" .format (name = op .__name__ )
129
- # TODO: docstring?
130
124
return set_function_name (cmp_method , name , cls )
131
125
132
126
Original file line number Diff line number Diff line change @@ -118,4 +118,7 @@ def test_elementwise_comparison_warning():
118
118
# this test.
119
119
idx = Index ([1 , 2 ])
120
120
with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
121
- idx == "a"
121
+ result = idx == "a"
122
+
123
+ expected = np .array ([False , False ])
124
+ tm .assert_numpy_array_equal (result , expected )
You can’t perform that action at this time.
0 commit comments