snowflake.snowpark.DataFrame.unionAllByName¶
- DataFrame.unionAllByName(other: DataFrame) DataFrame [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/dataframe.py#L2652-L2688)¶
Returns a new DataFrame that contains all the rows in the current DataFrame and another DataFrame (
other
), including any duplicate rows.This method matches the columns in the two DataFrames by their names, not by their positions. The columns in the other DataFrame are rearranged to match the order of columns in the current DataFrame.
Example:
>>> df1 = session.create_dataframe([[1, 2]], schema=["a", "b"]) >>> df2 = session.create_dataframe([[2, 1]], schema=["b", "a"]) >>> df1.union_all_by_name(df2).show() ------------- |"A" |"B" | ------------- |1 |2 | |1 |2 | -------------
- Parameters:
other – the other
DataFrame
that contains the rows to include.