Exemple #1
0
def pd_range_index_eq_overload(self, other):

    self_is_range_index = isinstance(self, RangeIndexType)
    other_is_range_index = isinstance(other, RangeIndexType)

    if not (
            self_is_range_index and other_is_range_index or
        (self_is_range_index and
         (check_is_numeric_array(other) or isinstance(other, types.Number))) or
        ((check_is_numeric_array(self)
          or isinstance(self, types.Number) and other_is_range_index))):
        return None
    one_operand_is_scalar = isinstance(self, types.Number) or isinstance(
        other, types.Number)

    def pd_range_index_eq_impl(self, other):

        if one_operand_is_scalar == False:  # noqa
            if len(self) != len(other):
                raise ValueError("Lengths must match to compare")

        # names do not matter when comparing pd.RangeIndex
        left = self.values if self_is_range_index == True else self  # noqa
        right = other.values if other_is_range_index == True else other  # noqa
        return list(
            left == right
        )  # FIXME_Numba#5157: result must be np.array, remove list when Numba is fixed

    return pd_range_index_eq_impl
Exemple #2
0
def pd_int64_index_ne_overload(self, other):

    self_is_index = isinstance(self, Int64IndexType)
    other_is_index = isinstance(other, Int64IndexType)

    if not (self_is_index and other_is_index
            or (self_is_index and (check_is_numeric_array(other) or isinstance(other, types.Number)))
            or ((check_is_numeric_array(self) or isinstance(self, types.Number)) and other_is_index)):
        return None

    def pd_int64_index_ne_impl(self, other):

        eq_res = np.asarray(self == other)  # FIXME_Numba#5157: remove np.asarray and return as list
        return list(~eq_res)

    return pd_int64_index_ne_impl