snowflake.snowpark.DataFrame.intersect¶
- DataFrame.intersect(other: DataFrame) DataFrame [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/dataframe.py#L1943-L1975)¶
Returns a new DataFrame that contains the intersection of rows from the current DataFrame and another DataFrame (
other
). Duplicate rows are eliminated.Example:
>>> df1 = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"]) >>> df2 = session.create_dataframe([[1, 2], [5, 6]], schema=["c", "d"]) >>> df1.intersect(df2).show() ------------- |"A" |"B" | ------------- |1 |2 | -------------
- Parameters:
other – the other
DataFrame
that contains the rows to use for the intersection.