File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -95,13 +95,19 @@ def cmp_method(self, other):
95
95
if needs_i8_conversion (self ) and needs_i8_conversion (other ):
96
96
return self ._evaluate_compare (other , op )
97
97
98
+ other = np .asarray (other )
98
99
if is_object_dtype (self ) and self .nlevels == 1 :
99
100
# don't pass MultiIndex
100
101
with np .errstate (all = 'ignore' ):
101
102
result = ops ._comp_method_OBJECT_ARRAY (op , self .values , other )
103
+
104
+ elif self .values .dtype .type != other .dtype .type :
105
+ # short-circuit on dtype inequity
106
+ result = op is not operator .eq
107
+
102
108
else :
103
109
with np .errstate (all = 'ignore' ):
104
- result = op (self .values , np . asarray ( other ) )
110
+ result = op (self .values , other )
105
111
106
112
# technically we could support bool dtyped Index
107
113
# for now just return the indexing array directly
You can’t perform that action at this time.
0 commit comments