snowflake.snowpark.DataFrame.union¶
- DataFrame.union(other: DataFrame) DataFrame [source]¶
Returns a new DataFrame that contains all the rows in the current DataFrame and another DataFrame (
other
), excluding any duplicate rows. Both input DataFrames must contain the same number of columns.- Example::
>>> df1 = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"]) >>> df2 = session.create_dataframe([[0, 1], [3, 4]], schema=["c", "d"]) >>> df1.union(df2).show() ------------- |"A" |"B" | ------------- |1 |2 | |3 |4 | |0 |1 | -------------
- Parameters:
other – the other
DataFrame
that contains the rows to include.