snowflake.snowpark.DataFrame.union¶
- DataFrame.union(other: DataFrame) DataFrame [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/dataframe.py#L1774-L1806)¶
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.