@@ -899,31 +899,12 @@ def _make_compare(op):
899899 opname = "__{op}__" .format (op = op .__name__ )
900900
901901 def _evaluate_compare (self , other ):
902-
903- # if we have a Categorical type, then must have the same
904- # categories
905- if isinstance (other , CategoricalIndex ):
906- other = other ._values
907- elif isinstance (other , Index ):
908- other = self ._create_categorical (other ._values , dtype = self .dtype )
909-
910- if isinstance (other , (ABCCategorical , np .ndarray , ABCSeries )):
911- if len (self .values ) != len (other ):
912- raise ValueError ("Lengths must match to compare" )
913-
914- if isinstance (other , ABCCategorical ):
915- if not self .values .is_dtype_equal (other ):
916- raise TypeError (
917- "categorical index comparisons must "
918- "have the same categories and ordered "
919- "attributes"
920- )
921-
922- result = op (self .values , other )
902+ with np .errstate (all = "ignore" ):
903+ result = op (self .array , other )
923904 if isinstance (result , ABCSeries ):
924905 # Dispatch to pd.Categorical returned NotImplemented
925906 # and we got a Series back; down-cast to ndarray
926- result = result .values
907+ result = result ._values
927908 return result
928909
929910 return compat .set_function_name (_evaluate_compare , opname , cls )
0 commit comments