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

snowflake.snowpark.DataFrame.unionAllByName

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

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

other – the other DataFrame that contains the rows to include.