Concatenate two PySpark dataframes

后端 未结 10 1372
独厮守ぢ
独厮守ぢ 2020-12-02 16:28

I\'m trying to concatenate two PySpark dataframes with some columns that are only on each of them:

from pyspark.sql.functions import randn, rand

df_1 = sqlC         


        
10条回答
  •  醉话见心
    2020-12-02 17:22

    You can use unionByName to make this:

    df = df_1.unionByName(df_2)
    

    unionByName is available since Spark 2.3.0.

提交回复
热议问题