Example #1
0
    def isin(
        self,
        values: Value | Sequence[Value],
    ) -> ir.BooleanValue:
        """Check whether this expression's values are in `values`.

        Parameters
        ----------
        values
            Values or expression to check for membership

        Returns
        -------
        BooleanValue
            Expression indicating membership

        Examples
        --------
        >>> import ibis
        >>> table = ibis.table([('string_col', 'string')])
        >>> table2 = ibis.table([('other_string_col', 'string')])
        >>> expr = table.string_col.isin(['foo', 'bar', 'baz'])
        >>> expr2 = table.string_col.isin(table2.other_string_col)
        """
        import ibis.expr.operations as ops

        return ops.Contains(self, values).to_expr()
Example #2
0
def isin(arg, values):
    """
    Check whether the value expression is contained within the indicated
    list of values.

    Parameters
    ----------
    values : list, tuple, or array expression
      The values can be scalar or array-like. Each of them must be
      comparable with the calling expression, or None (NULL).

    Examples
    --------
    expr = table.strings.isin(['foo', 'bar', 'baz'])

    expr2 = table.strings.isin(table2.other_string_col)

    Returns
    -------
    contains : BooleanValue
    """
    op = _ops.Contains(arg, values)
    return op.to_expr()