snowflake.snowpark.functions.in_¶
- snowflake.snowpark.functions.in_(cols: List[ColumnOrName], *vals: DataFrame | LiteralType | Iterable[LiteralType]) Column[source]¶
Returns a conditional expression that you can pass to the filter or where methods to perform the equivalent of a WHERE … IN query that matches rows containing a sequence of values.
The expression evaluates to true if the values in a row matches the values in one of the specified sequences.
The following code returns a DataFrame that contains the rows in which the columns c1 and c2 contain the values: - 1 and “a”, or - 2 and “b” This is equivalent to
SELECT * FROM table WHERE (c1, c2) IN ((1, 'a'), (2, 'b')).Example:
The following code returns a DataFrame that contains the rows where the values of the columns c1 and c2 in df2 match the values of the columns a and b in df1. This is equivalent to
SELECT * FROM table2 WHERE (c1, c2) IN (SELECT a, b FROM table1).Example:
- Args::
cols: A list of the columns to compare for the IN operation. vals: A list containing the values to compare for the IN operation.