简体   繁体   English

2个不同数据框的绑定列引发

[英]Bind columns of 2 different dataframes spark

I have 2 different data frames in spark and I'd like to bind their columns to form a unique data frame. 我在spark中有2个不同的数据框,我想将它们的列绑定以形成唯一的数据框。 How can I do it using spark scala? 如何使用Spark Scala做到这一点?
Thanks 谢谢

It sounds like you want to join two dataframes. 这听起来像你想连接两个dataframes。

To do this you need to have a key that you will bind (join) the columns of a row/s with the columns of another row/s on. 为此,您需要有一个键,用于将一行的列与另一行的列绑定(连接)。 You can find more information here: https://www.waitingforcode.com/apache-spark-sql/join-types-spark-sql/read 您可以在这里找到更多信息: https : //www.waitingforcode.com/apache-spark-sql/join-types-spark-sql/read

myDataframe
  .join(otherDataframe, col("x") === col("y"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM