Concatenate two PySpark dataframes

后端 未结 10 1373
独厮守ぢ
独厮守ぢ 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:25

    To concatenate multiple pyspark dataframes into one:

    from functools import reduce
    
    reduce(lambda x,y:x.union(y), [df_1,df_2])
    

    And you can replace the list of [df_1, df_2] to a list of any length.

提交回复
热议问题