How to add a Spark Dataframe to the bottom of another dataframe?

前端 未结 1 2036
既然无缘
既然无缘 2021-02-05 08:15

I can use withcolumnto add new columns to a Dataframe. But in scala how can I add new rows to a DataFrame?

I\'m trying to add a dataframe to the bottom of

1条回答
  •  梦谈多话
    2021-02-05 09:03

    If they have the same schema, simply use union for spark 2+:

    val dfUnion = df1.union(df2)
    

    Or unionAll for spark 1+:

    val dfUnion = df1.unionAll(df2)
    

    0 讨论(0)
提交回复
热议问题