You are viewing documentation about an older version (1.1.0). View latest version

snowflake.snowpark.DataFrame.intersect

DataFrame.intersect(other: DataFrame) DataFrame[source]

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    |
-------------
Copy
Parameters:

other – the other DataFrame that contains the rows to use for the intersection.